Skip to content

Commit

Permalink
Site Editor: Avoid using edited entity state in site editor loading h…
Browse files Browse the repository at this point in the history
…ook (#66924)

Co-authored-by: youknowriad <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent 5f29581 commit 1e82c94
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/edit-site/src/components/layout/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ import { useEffect, useState } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';

/**
* Internal dependencies
*/
import useEditedEntityRecord from '../use-edited-entity-record';

const MAX_LOADING_TIME = 10000; // 10 seconds

export function useIsSiteEditorLoading() {
const { isLoaded: hasLoadedPost } = useEditedEntityRecord();
const [ loaded, setLoaded ] = useState( false );
const inLoadingPause = useSelect(
( select ) => {
Expand Down Expand Up @@ -64,5 +58,5 @@ export function useIsSiteEditorLoading() {
}
}, [ inLoadingPause ] );

return ! loaded || ! hasLoadedPost;
return ! loaded;
}

0 comments on commit 1e82c94

Please sign in to comment.