bpanel-org / bpanel

A Blockchain Management System, powered by bcoin
https://bpanel.org
Other
53 stars 23 forks source link

Persist state for whitelisted plugins #174

Closed bucko13 closed 5 years ago

bucko13 commented 5 years ago

Fixes #171 To test, you can use simple-mining which whitelists its store so that the coinbase address persists across refreshes. You can also test with price-settings as that should persist your choice for hiding the menu. You'll also want two clients setup to switch between. Any chains will do.

1) add a coinbase address to simple mining (it can be any text since we're not doing validation) 2) refresh the page. The address should still be there 3) switch to another client. the address should be cleared.

The issue had to do with when the app was mounting and hydrating the clients, the client was being set when the listener was already attached. This would cause an app state reset RESET_STATE action to be dispatched which cleared persistent state (as it is supposed to normally, like when you switch clients in the header).

Includes some other fixes for binding the listeners and re-generated package-lock for bumped dependencies.

bucko13 commented 5 years ago

Demo: refresh

tynes commented 5 years ago

I notice that after setting a coinbase address in the plugin and refreshing the page, the same coinbase address is used. Switching between clients also resets the coinbase address

bucko13 commented 5 years ago

@tynes

I notice that after setting a coinbase address in the plugin and refreshing the page, the same coinbase address is used.

Yes, this is expected behavior (as in the gif). If we wanted address to change, that would be a different functionality on the plugin itself. The persisting for the address is mainly a convenience for testing so that you can easily go back and keep mining without having to retrieve a new address.