Skip to content

Commit

Permalink
Add a comment on the arbitrary timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed May 8, 2023
1 parent 8f5790e commit c7fed44
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ export default function Editor() {
useEffect( () => {
if ( ! hasResolvingSelectors && ! loaded ) {
clearTimeout( timeoutRef.current );

/*
* We're using an arbitrary 1s timeout here to catch brief moments
* without any resolving selectors that would result in displaying
* brief flickers of loading state and loaded state.
*
* It's worth experimenting with different values, since this also
* adds 1s of artificial delay after loading has finished.
*/
timeoutRef.current = setTimeout( () => {
setLoaded( true );
}, 1000 );
Expand Down

0 comments on commit c7fed44

Please sign in to comment.