Skip to content

Commit

Permalink
Editor: Avoid a 'flash' when rendering in 'template-locked' mode (Wor…
Browse files Browse the repository at this point in the history
…dPress#69173)

* Editor: Avoid a 'flash' when rendering in 'template-locked' mode
* Relocate some checks

Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
Co-authored-by: Mayank-Tripathi32 <[email protected]>
  • Loading branch information
4 people authored and Kallyan01 committed Feb 24, 2025
1 parent 9c72f9f commit 6d99851
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ export const ExperimentalEditorProvider = withRegistryProvider(
: undefined;
const hasDefaultMode = RENDERING_MODES.includes( _defaultMode );

// Wait for template resolution when rendering in a `template-locked` mode.
const hasResolvedMode =
hasLoadedPostObject && _defaultMode === 'template-locked'
? hasTemplate
: true;

return {
editorSettings: getEditorSettings(),
isReady: __unstableIsEditorReady() && hasLoadedPostObject,
isReady: __unstableIsEditorReady() && hasResolvedMode,
mode: getRenderingMode(),
defaultMode:
hasTemplate && hasDefaultMode
? _defaultMode
: 'post-only',
defaultMode: hasDefaultMode ? _defaultMode : 'post-only',
selection: getEditorSelection(),
postTypeEntities:
post.type === 'wp_template'
Expand Down

0 comments on commit 6d99851

Please sign in to comment.