-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stateFn for #each loop #16
Comments
You should not use |
Hi, as this issue is really vital for my project I created a small example to examine the rerendering behavior of simple blaze templates compared to flow components. Please excuse the rather long message.
You can find the source code here: https://github.com/christianvoigt/flow-components-rerendering-test I have created a local collection called Greetings and inserted some initial greetings of the form Please open the console to get log messages about how many "greeting templates" and "greeting components" were created, rendered and destroyed. If you click on the first link that inserts a new document into the collection, you will see that only one new template is created and rendered, while all flow components are destroyed, recreated and rerendered. This is the problem we already talked about. Interestingly, this problem only occured if I used So one option would be to only use live queries in these cases. But this is very limiting. I thought maybe it would be possible to wrap this.text in the If you click on the second link, the text of one document in the collection will be updated. As I already said above, this does not cause a rerendering of any of the normal templates, even though I used the Do you have any ideas for a workaround I could implement on my own? If I can't get this to behave in the same fine-grained way as it did before, I fear I have to revert to simple Blaze templates for now. |
Yes, I have the same question sort of... Can you perhaps show an example when you use parent + child components looping over a collection and what the default/expected behavior is when you update the cursor/document or any reactive var/state in the component. |
@arunoda If we shouldn't pass |
+1 |
I have this issue too of components inside #each loops always rendering on changes. Any idea on how to fix it? |
Hi, I migrated the templates of my app to FlowComponents and overall this worked out great and improved my code a lot. However, in some cases I have lost the fine-grained reactivity I had before. These cases follow all the same pattern:
{{#each state$myArray}} {{>render component="my-component" myProperty=this}} {{/each}}
If I understand this right, I need to use stateFn$ to wrap the value of myProperty in a function, to avoid rerenderings if myProperty changes. But how can I do this in these cases, where stateFn$myProperty can not be used? Another case in which this problem occurs is something like:
{{>render component="my-component" myProperty=state$myObj.myProperty}}
The text was updated successfully, but these errors were encountered: