Basic global state subscriptions + updates
Is your feature request related to a problem? Please describe.
I'm currently using the re-frame-like xframe for global subscriptions and state updates. However, in many of my use-cases I merely need get-like and get-in-like subscriptions and assoc/update(-in)-like handlers.
Describe the solution you'd like Reagent's ratom + cursor compatible with reacts hooks. Like this but global.
Describe alternatives you've considered xframe has been my alternative so far. I think it would be nice to provide a less opinionated solution to global state updates and subscriptions.
Would something like this work for you?
(def db (atom {:items [{:id 1}]}))
(def item-1 (cursor-in db [:items 0]))
(defn change-item! []
(swap! item-1 :id inc))
If derefs of item-1 in UI components result in reactive updates upon change, then yes, exactly
Side note: another problem this would alleviate is not being able to render multiple apps in the same browser context because the current xframe impl uses only one db adapton.
This is a separate issue, feel free to file a ticket for that.
Hi @roman01la! Anything I can do to help with this feature? I've looked over the xframe source but it goes above my head. But I could probably put a PR together w/ some pointers from you.