hamedpro / freeflow-core

🩵⚡️next generation of decentralised collaboration
3 stars 1 forks source link

Single source of truth in UHC #228

Open hamedpro opened 1 year ago

hamedpro commented 1 year ago

now UHC works for its own and syncs UHC context state. UHC must just be a tool which is a computation layer on top of context state

hamedpro commented 1 year ago

also instead of onChanges just use setters.

so after these changes are applied when you wanna change for example transactions you just change uhc.transactions and it updates context under the hood and everything in ui updates. note that now when you for example change max_sync_depth of UHC ui doesnt update

hamedpro commented 1 year ago

so UHC is just a wrapper around context state. it does not have any data inside itself. whenever you read something a getter gives you what you want and when you set a setter updates context state.

hamedpro commented 1 year ago

also virtual local storage must also be merged into UHC context. its so simple to do it :

  1. when initialising UHC state give those props to it from local storage.
  2. set a useEffect to update localStorage every time one of those props change.