Template don't rerender when id change
See original GitHub issueIt seems that template don’t re render when the id change. For instance if my route looks like this:
FlowRouter.route('/u/:_id', {
name: 'userItem',
action: function() {
console.log('go to ', FlowRouter.getParam('_id'));
BlazeLayout.render( 'appBody', { main: 'userItem', options: {_id: FlowRouter.getParam('_id')} } );
},
});
and I go from /u/id1
to /u/id2
, I get a log as excepted, but the template is not re created. Is that by design of BlazeLayout
? It would be nice to have an option to recreate the template, especially when doing template level subscriptions that should be closed when the id change.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to stop re-rendering lists in React? - Alex Sidorenko
First, let's simplify our example by removing all props from the Item . We will still update the parent state but won't pass...
Read more >How to prevent re-rendering of components that have not ...
I would like to prevent the re-rendering and only re-render the component that actually changes. I have seen that useCallback is the right...
Read more >5 Ways to Avoid React Component Re-Renderings
In the above example, useCallBack() memoizes the onClick callback. So, it will not re-render the component if the user clicks the same item...
Read more >React re-renders guide: everything, all at once - Developer way
In your example 2 yes, the state change triggers re-render. And Example1 is a bad antipattern exactly because it will not cause re-render,...
Read more >When does React re-render components? - Felix Gerschau
For example, if only the attribute of an element changes, React will ... The first point is arguably not that important since React...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MichaelJCole in my case it reloads the complete site which is really ugly.
Is there still no solution to force a route change on the same layout after over two years?
Also ran into that problem. Same route, different params, no reaction. Calling
BlazeLayout.reset()
beforeFlowRouter.go()
forces the re-render successfully, but I agree: that feels ugly.