New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core Data: Move the template lookup to core-data selectors/resolvers #55883
Conversation
: undefined; | ||
}, | ||
[ slug, isCustom ] | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorgefilipecosta can you help me test the start templates please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested that by creating a new template and verifying the proper fallback template is suggested in the modal. Alternatively you 'empty' a template completely, save and reload, in order for the modal to show up. It seems it's working fine.
Size Change: +1.22 kB (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
( query ) => | ||
async ( { dispatch } ) => { | ||
const template = await apiFetch( { | ||
path: addQueryArgs( '/wp/v2/templates/lookup', query ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've discovered a different issue here while testing. If the current default template is empty the REST endpoint returns the next one available from template hierarchy. That's an issue, because front end and the editor show different things. I'll create an issue for this.
Flaky tests detected in 15f0adc. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6782750343
|
What?
Extracted from #55844
This PR adds
getDefaultTemplateId
selectors to core-data to avoid the adhoc apiFetch calls. The main reason I'm doing this PR is because I want to deprecate thesetPage
action in the site editor because it does too much and replace it with a React hook like done in #55844Testing Instructions
1- Test navigation between different sections of the site editor (pages, single pages...)
2- Test starter templates.