Skip to content

Commit

Permalink
Fix issues with dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
aswitalski committed Mar 26, 2020
1 parent 1778e2b commit 4e0d48d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/core/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,17 @@ limitations under the License.

if (this.queue.length) {
level = level + 1;
if (level >= 3) {
throw new Error(
'Too many cycles updating state in lifecycle methods!');
if (level > 3) {
try {
throw new Error(
'Too many cycles updating state in lifecycle methods!');
} finally {
level = 0;
}
}
const tasks = [...this.queue];
setTimeout(() => {
for (const command of this.queue) {
for (const command of tasks) {
this.execute(command, root);
command.done();
}
Expand Down
1 change: 1 addition & 0 deletions src/core/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ limitations under the License.
} catch (e) {
return;
}
this.dispatcher.ignoreIncoming();
this.plugins.destroy();
this.plugins = null;
this.parentNode = null;
Expand Down

0 comments on commit 4e0d48d

Please sign in to comment.