Skip to content
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

Hook for saving/updating post in Gutenberg #40765

Closed
wpsoul opened this issue May 2, 2022 · 1 comment
Closed

Hook for saving/updating post in Gutenberg #40765

wpsoul opened this issue May 2, 2022 · 1 comment
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@wpsoul
Copy link

wpsoul commented May 2, 2022

In current point we need to use hook like

`subscribe( () => {
const isSavingPost = select('core/editor').isSavingPost();
const isAutosavingPost = select('core/editor').isAutosavingPost();

if ( isAutosavingPost && ! isSavingPost ) {
return;
}

// Do action.
});`

But this trigger to get saving post function from core/editor on any changes in editor. I tried console.log to see when it's triggered and found that in some situations, it's made near 200 requests on just typing a word. So, why do not add hook for Gutenberg the same as we have for PHP hook save_post?

@t-hamano
Copy link
Contributor

Hi @wpsoul,

Thanks for opening this.
This looks like a duplicate of #17632 / #15568 / #13413, so we will close this issue at once.

I think #17632 is pretty close to this report, although it have been closed.
Can we consolidate the discussion there?

@t-hamano t-hamano added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

2 participants