question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template don't rerender when id change

See original GitHub issue

It 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:open
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mkluehcommented, Nov 11, 2017

@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?

0reactions
afriC84commented, Jan 24, 2018

Also ran into that problem. Same route, different params, no reaction. Calling BlazeLayout.reset() before FlowRouter.go() forces the re-render successfully, but I agree: that feels ugly.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found