-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Site Editor: Avoid using edited entity state in site editor loading hook #66924
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
const MAX_LOADING_TIME = 10000; // 10 seconds | ||
|
||
export function useIsSiteEditorLoading() { | ||
const { isLoaded: hasLoadedPost } = useEditedEntityRecord(); |
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.
my thinking is that this is a resolver as well, so there's no need to add this specifically here.
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.
This makes sense. I added a conditional breakpoint though and sometimes hasLoadedPost = false
and loaded = true
.
Visually though I couldn't spot something different and I also tried with throttling the network speed.
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.
This makes sense. I added a conditional breakpoint though and sometimes hasLoadedPost = false and loaded = true.
Was this during the initial loading or when you navigated between the pages? Seems the latter right and in that case it seems that it's probably ok.
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.
The latter. Yeah, I think it will be fine.
Size Change: -10 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
6e5c6e0
to
3f90276
Compare
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.
Thank you!
Related #66921
What?
As the site editor is growing to become a multi page app, it doesn't really make sense to have an edited post type and context state in it.
That state is forcing us today to have a two synchronization mechanism between the url and the state causing some issues related to performance and some hidden bugs at times.
Ideally the routes would just pass the post type, post id to the editor component. The current PR helps to go in that direction by removing getEditedPostType usage from the isLoading hook.
Testing Instructions