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.

[Ember 2.10] Uncaught Error: infinite rendering invalidation detected

See original GitHub issue

2.10 introduced Glimmer 2. Glimmer 2 introduced infinite rendering invalidation detection. Not entirely sure what that is, haven’t dug enough.

We have a master detail layout in our app, and the detail panel is what uses redux. We have it carved out as an addon.

When a user clicks the first item, none of the detail components exist yet. The detail panel slides in, the detail addon top level component is rendered with a handful of inputs, it makes a few server calls and renders all the things.

When a user clicks a second item, because the panel is already open, we have ~15ish components already bound to state and listening for updates. Clicking the second item passes in a bunch of inputs which are immediately dispatch({ type: INITIALIZE: payload: inputs}) into state.

There are enough components listening to some of the inputs that handleChange is called a good number of times. Too many. And then that error happens and things explode.

There are definitely steps I can take to reduce the number of components bound into state. I can also do some work to batch some actions so that synchronous actions that happen to have some overlapping state do not get updated multiple times.

But I can absolutely foresee, post improvements, still having this issue and being forced to destroy most all of the detail before I do anything with the new inputs so that components aren’t listening for changes. In some cases this might be the ideal thing to do anyway, and I expect that’ll be one of the best improvements I can make, but in some it isn’t ideal.

Not sure exactly what ember-redux can do differently to smooth this over, but I’d guess it’ll be something other folks run into at some point.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dbashfordcommented, Dec 14, 2016

Started from scratch and added things I learned yesterday one at a time. I quickly got to the few things causing me trouble.

When the errors were first seen, the stack trace took us back to handleChanges every time. As I started eliminating redux usage yesterday, another piece of code in our app became the problem. So it isn’t ember-redux alone, more of a larger run loop usage theme.

We are using ember-spaniel for viewport tracking. We have SpanielObserver being registered on didInsertElement for a component that can be rendered 10-30 times on the page. It was being registered like this

    const observer = new SpanielObserver(([entry]) => {
      run(() => {
        this.set('viewportEntered', entry.entering);
      });
    }, options);

That run is called immediately for any components within a certain distance of the viewport. At most 16 times all at once.

Changed it to:

    const observer = new SpanielObserver(([entry]) => {
      run.scheduleOnce('afterRender', () => {
        this.set('viewportEntered', entry.entering);
      });
    }, options);

And things got better. But the app didn’t fix until this was also changed in ember-redux:

this.unsubscribe = redux.subscribe(() => {
  run(() => this.handleChange());
});

turned into this:

this.unsubscribe = redux.subscribe(() => {
  run.next(() => this.handleChange());
});

Both of the above changes are necessary to get us to a happy place, at least without making more modifications. Still re-doing a lot of tweaking from yesterday to see if I can get to a point where the run.next isn’t required.

0reactions
toranbcommented, Dec 15, 2016

@dbashford wow this is an epic find -can’t believe we didn’t take more care w/ ember.run prior to this issue 😃 thanks for the hard work/debugging effort!!! Hoping to land a fix for this tomorrow

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Uncaught Error: infinite rendering invalidation ...
With 2.9-beta2 I was getting a white screen with no ember container and no content rendered. With beta3 I'm getting a flash of...
Read more >
Error: infinite rendering invalidation detected - Stack Overflow
Solution: Move the action the controller or use an addon like https://github.com/DockYard/ember-route-action-helper will solve the problem.
Read more >
Any thought on what might case `infinite rendering invalidation ...
RWJBlue says, basically what is happening is that something is throwing an error during rendering (this should be “ok”, and print the error...
Read more >
[Solved]-Error: infinite rendering invalidation detected-ember.js
Solution: Move the action the controller or use an addon like https://github.com/DockYard/ember-route-action-helper will solve the problem.
Read more >
js.ember Changelog - pyup.io
- [15168](https://github.com/emberjs/ember.js/pull/15168) [BUGFIX] Ensure that retrying a transition created with `replaceWith` causes a history replacement. - ...
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