New “isReady” flag to avoid invalid page content

Before this change, the onboarding wizard was briefly displayed on every page load
This commit is contained in:
Philipp Stracker 2024-10-28 18:57:39 +01:00
parent 6a80a016cf
commit 3d05c65f50
No known key found for this signature in database
6 changed files with 30 additions and 1 deletions

View file

@ -2,7 +2,7 @@ import { dispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { apiFetch } from '@wordpress/data-controls';
import { NAMESPACE } from '../constants';
import { setOnboardingDetails } from './actions';
import { setIsReady, setOnboardingDetails } from './actions';
/**
* Retrieve settings from the site's REST API.
@ -13,6 +13,7 @@ export function* getPersistentData() {
try {
const result = yield apiFetch( { path } );
yield setOnboardingDetails( result );
yield setIsReady( true );
} catch ( e ) {
yield dispatch( 'core/notices' ).createErrorNotice(
__(