diff --git a/packages/@ember/-internals/environment/lib/env.ts b/packages/@ember/-internals/environment/lib/env.ts index e6d907a62ff..7e42a6f04ef 100644 --- a/packages/@ember/-internals/environment/lib/env.ts +++ b/packages/@ember/-internals/environment/lib/env.ts @@ -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[]; }, diff --git a/packages/@ember/-internals/glimmer/lib/renderer.ts b/packages/@ember/-internals/glimmer/lib/renderer.ts index 50d2ee1c45a..0a91acfd7c3 100644 --- a/packages/@ember/-internals/glimmer/lib/renderer.ts +++ b/packages/@ember/-internals/glimmer/lib/renderer.ts @@ -1,3 +1,4 @@ +import { ENV } from '@ember/-internals/environment'; import { runInTransaction, setHasViews } from '@ember/-internals/metal'; import { fallbackViewRegistry, @@ -229,7 +230,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(); diff --git a/tests/docs/expected.js b/tests/docs/expected.js index 3a9e419fca3..1842c944a95 100644 --- a/tests/docs/expected.js +++ b/tests/docs/expected.js @@ -10,6 +10,7 @@ module.exports = { '[]', '_APPLICATION_TEMPLATE_WRAPPER', '_JQUERY_INTEGRATION', + '_RERENDER_LOOP_LIMIT', '_TEMPLATE_ONLY_GLIMMER_COMPONENTS', '__container__', '_activeQPChanged',