Fork me on GitHub
#rum
<
2018-02-27
>
amarjeet19:02:36

@tonsky please see the above snippet, if you get time. Thanks

roman01la19:02:22

@amarjeet looks like you are fetching data, storing it in the state, component re-renders and fetching runs again and so on

amarjeet19:02:14

@roman01la so, when the fetching re-runs, the local-state atom's value doesn't change. And, if the value doesn't change, the the App component's rendering should stop - thats my understanding of rum/reactive mixin

amarjeet19:02:46

the local-state atom's value doesn't change because the fetch process fetches the same data

roman01la19:02:49

@amarjeet AFAIK, reactive mixin doesn’t check if the state has changed

amarjeet19:02:39

no, it has subscribed to the local-state atom. So, for the 1st fetch, the value of local-state atom changes, and triggers the App render. But for the 2nd time, its value doesn't change, but assoc process does happen

amarjeet20:02:06

So, it seems that as long as local-state gets the assoc operation (even though the final value doesn't change), the App component will render

roman01la20:02:08

every time you swap! the atom, it triggers watcher function here https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.cljs#L325 which re-renders the component

amarjeet20:02:10

thats why its becoming a loop

amarjeet20:02:23

thanks much @roman01la for this