Message from JavaScript discussions
October 2016
— I dont know what the others says
JavaScript Enthusiasts
All about JavaScript programming language and its ecosystem.
Off topic messages will be deleted.
https://telegram.me/javascriptenthusiasts
— Anyone familiar with the Flux pattern?
— O/
— What is the problem?
— I am rolling my own and ran into an issue with ControllerViews
— If a ControllerView takes over the DOM (deletes contents and replaces with it's own components), the older components of the previous ControllerView still keep state in the background. The next time you go to load that older set of components, and the data is the same, they won't render (per the "dont render if the data doesn't change" rule)
— I can think of a few solutions, some good, some icky. How do you deal with it?
— Some stuff like:
Keep 1 variable that lists the last controllerview to use the DOM
or wipe state of all components in non-presenting views,
or delete those components and only create them when needed.
Currently on first init all controllerviews and their components are in memory
— #1 sucks because that will cause confusion between non-root controllerviews and nested controllerviews
— Use react or your vanilla code ?
— My own code