Skip to content

Commit

Permalink
Merge pull request #17684 from rwjblue/expose-customizable-rerender-l…
Browse files Browse the repository at this point in the history
…imit

[BUGFIX lts] Enable maximum rerendering limit to be customized.
  • Loading branch information
rwjblue committed Mar 4, 2019
2 parents 344fc7e + ff8338d commit 2c14616
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/@ember/-internals/environment/lib/env.ts
Expand Up @@ -111,6 +111,19 @@ export const ENV = {
*/
_JQUERY_INTEGRATION: true,

/**
Controls the maximum number of scheduled rerenders without "settling". In general,
applications should not need to modify this environment variable, but please
open an issue so that we can determine if a better default value is needed.
@property _RERENDER_LOOP_LIMIT
@for EmberENV
@type number
@default 1000
@private
*/
_RERENDER_LOOP_LIMIT: 1000,

EMBER_LOAD_HOOKS: {} as {
[hook: string]: Function[];
},
Expand Down
3 changes: 2 additions & 1 deletion packages/@ember/-internals/glimmer/lib/renderer.ts
@@ -1,3 +1,4 @@
import { ENV } from '@ember/-internals/environment';
import { runInTransaction } from '@ember/-internals/metal';
import {
fallbackViewRegistry,
Expand Down Expand Up @@ -227,7 +228,7 @@ let loops = 0;
function loopEnd() {
for (let i = 0; i < renderers.length; i++) {
if (!renderers[i]._isValid()) {
if (loops > 10) {
if (loops > ENV._RERENDER_LOOP_LIMIT) {
loops = 0;
// TODO: do something better
renderers[i].destroy();
Expand Down
1 change: 1 addition & 0 deletions tests/docs/expected.js
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'[]',
'_APPLICATION_TEMPLATE_WRAPPER',
'_JQUERY_INTEGRATION',
'_RERENDER_LOOP_LIMIT',
'_TEMPLATE_ONLY_GLIMMER_COMPONENTS',
'__container__',
'_activeQPChanged',
Expand Down

0 comments on commit 2c14616

Please sign in to comment.