Skip to content

Commit

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

* 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 Feb 18, 2025
1 parent ef94f5f commit c031b36
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 c031b36

Please sign in to comment.