Closed pikonha closed 3 months ago
Seems good, I'm not a big fan of using local storage coupled with redux, in my opinion it's better to update them separately and keep them decoupled, if we decide to replace redux for context API in the near future, it'll be easier
@lgahdl OK! It seems good to me to have the data getter and setter present in useNameRegistration()
this React hook could be the connection between Redux state and localStorage state 👍🏼
Persist data of name registrations
Store in localStorage all the relevant data relative to a name registration
As the user makes his commitment to buying a domain, a blockchain transaction is done and we, as technology solutions providers, do not want our users to lose money. Nowadays, if this same user refreshes the page or leaves it for any reason, he will need to start the name registration process from the beginning, which is painful for a good UX.
The goal of this issue is to, once a user makes a name registration commit, store relevant data about this started name registration process.
This data should be stored in localStorage for wider error cases support: internet connection, zeroed battery, closed tab, etc.
This data should always be tried to be accessed when a name registration starts, meaning that, if some data is located relative to the searched name, we go to step 1 and if no data is located, we go to step 2, being these:
Alternatives
Is there any out-of-the-box way to connect Redux to localStorage?
Related Code
You need to save this data based on the authed user address:
Note: see how we save the
secretUsed
: this needs to be the same between commit and register transactions 👍🏼Additional Context
Please understand the different possible userflows so we store all the relevant data.