Skip to content

Commit

Permalink
Fix flash of 'Not found' error message when fetching a reusable block
Browse files Browse the repository at this point in the history
Re-order the FETCH_REUSABLE_BLOCKS effect so that the reusable block is
added to the store before it is marked as no longer being fetched. This
prevents core/block from briefly flashing the 'Not found' error message
in between dispatches.
  • Loading branch information
noisysocks committed Mar 13, 2018
1 parent 52ed1cc commit 3778bdf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions editor/store/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,18 @@ export default {

result.then(
( reusableBlockOrBlocks ) => {
dispatch( {
type: 'FETCH_REUSABLE_BLOCKS_SUCCESS',
id,
} );

dispatch( receiveReusableBlocks( map(
castArray( reusableBlockOrBlocks ),
( reusableBlock ) => ( {
reusableBlock,
parsedBlock: parse( reusableBlock.content )[ 0 ],
} )
) ) );

dispatch( {
type: 'FETCH_REUSABLE_BLOCKS_SUCCESS',
id,
} );
},
( error ) => {
dispatch( {
Expand Down

0 comments on commit 3778bdf

Please sign in to comment.