Skip to content

Commit

Permalink
Editor: Use getRegistry control for next change subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jul 10, 2019
1 parent 37a7ba9 commit 468f908
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/editor/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const controls = {
( registry ) => () => new Promise( ( resolve ) => {
const unsubscribe = registry.subscribe( () => {
unsubscribe();
resolve( registry );
resolve();
} );
} )
),
Expand Down

0 comments on commit 468f908

Please sign in to comment.