Skip to content

Run backtracking assertion only in debug mode#14856

Closed
elwayman02 wants to merge 2 commits intoemberjs:masterfrom
elwayman02:backtracking-debug-only
Closed

Run backtracking assertion only in debug mode#14856
elwayman02 wants to merge 2 commits intoemberjs:masterfrom
elwayman02:backtracking-debug-only

Conversation

@elwayman02
Copy link
Contributor

This wraps the assertNotRendered check in runInDebug so that it won't execute in production, even when either of the flags are enabled.

This wraps the `assertNotRendered` check in `runInDebug` so that it won't execute in production, even when either of the flags are enabled.
isEnabled('ember-glimmer-allow-backtracking-rerender')) {
assertNotRendered(obj, keyName, meta);
isEnabled('ember-glimmer-allow-backtracking-rerender')) {
runInDebug(() => { assertNotRendered(obj, keyName, meta) });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps move the runInDebug to wrap the if statement too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

isEnabled('ember-glimmer-allow-backtracking-rerender')) {
assertNotRendered(obj, keyName, meta);
}
assertNotRendered(obj, keyName, meta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug into this a bit, and it turns out that this isn't the right fix. Specifically, in the case where ember-glimmer-allow-backtracking-rerender is enabled we have to actually call assertNotRendered or we will not trigger a rerender when we hit this backtracking. In other words, wrapping this in runInDebug does avoid an error (due to a bug in assertNotRendered) but it also breaks the ability for rerendering to happen.

I submitted #14876 to address.

@rwjblue
Copy link
Member

rwjblue commented Jan 25, 2017

I'm going to close this in favor of the refactoring in #14876. Thank you for pointing out the issue and taking a stab at fixing!

@rwjblue rwjblue closed this Jan 25, 2017
@vvohra
Copy link

vvohra commented Jan 25, 2017

@rwjblue we're trying to fix the issue in this ticket for 2.10.2. I see that your PR is against master which has some more changes beyond this, so some methods don't exist or have been changed.

It's hard to figure out if there's a simpler fix to get this working in 2.10.2.

@rwjblue
Copy link
Member

rwjblue commented Jan 25, 2017

Its likely that my commit in #14876 applies cleanly to release-2-10 branch.

@vvohra
Copy link

vvohra commented Jan 25, 2017

There were conflicts but they aren't that bad. I'll try it once more and run through tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants