Replies: 1 comment
-
Hey this is a great question, but not the right place for this. Github issues for re-frame are for bug reports and feature requests. Support requests and usage questions should go to the #re-frame Clojure Slack channel, the ClojureScript mailing list, or the Reagent mailing list. Please send this to one of those forums and we can continue the discussion. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
May I ask for your guidence on how to implement component lifecycle management + events and subscription management in reframe.
I building project management application, imagine we have following sturecture:
When user click on any link in the left menu - we display content for it. Say, user clicks Board#1 - we fetch data associated with the board with id 1 and display all necessary components. Board content is quite complex application on its own, consists of many views, fetches its own data, subscribes for live updates via websocket, etc.
Then user clicks on Mindmap#5? We need to teardown everything what board created, clear subscription to data changes. And then start everything anew for Mindmap. It consists of its' own views, does completely different set of queries, subscriptions, etc.
Those are pretty much different apps.
What I thought of: use Form 3 views for root components to setup/teardown. In setup I create andd add new events re-frame handlers, subscriptions; live updates, etc. In teardown - removes all of them.
In the source code I've found
re-frame.registrar/clear-handlers
which can be used to do it, e.g.:clear-handlers :event :board-axes
clear-handlers :sub :sorted-board-axes
In case of
:sub
it doesn't really work without clearing subscription cache but it seems there is no way to partially clear it, only everything (re-frame/subs clear-subscription-cache!
)Is there way around it? Or maybe different approach to it?
Or maybe I want too much from re-frame it is not really good fit for such application?
As I've understood from tutorials and articles out there it is expected to set up all event and subscription handlers upfront and not to remove them. I don't think it works here as those content views are quite different inside.
Thank you for you help and time!
Beta Was this translation helpful? Give feedback.
All reactions