From 468f9088c8d5611737baca7f55bce8fb48b6d75f Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Wed, 10 Jul 2019 14:14:41 -0400 Subject: [PATCH] Editor: Use getRegistry control for next change subscription --- packages/editor/src/store/actions.js | 4 +++- packages/editor/src/store/controls.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/store/actions.js b/packages/editor/src/store/actions.js index ae31857cad45c5..8ea2c9a408de84 100644 --- a/packages/editor/src/store/actions.js +++ b/packages/editor/src/store/actions.js @@ -206,7 +206,7 @@ export function __experimentalTearDownEditor() { */ export function* __experimentalSubscribeSources() { while ( true ) { - const registry = yield awaitNextStateChange(); + yield awaitNextStateChange(); // The bailout case: If the editor becomes unmounted, it will flag // itself as non-ready. Effectively unsubscribes from the registry. @@ -215,6 +215,8 @@ export function* __experimentalSubscribeSources() { break; } + const registry = yield getRegistry(); + let reset = false; for ( const source of Object.values( sources ) ) { if ( ! source.getDependencies ) { diff --git a/packages/editor/src/store/controls.js b/packages/editor/src/store/controls.js index ff4c82fb77499e..3b0288d00b0a5b 100644 --- a/packages/editor/src/store/controls.js +++ b/packages/editor/src/store/controls.js @@ -28,7 +28,7 @@ const controls = { ( registry ) => () => new Promise( ( resolve ) => { const unsubscribe = registry.subscribe( () => { unsubscribe(); - resolve( registry ); + resolve(); } ); } ) ),