-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Replace hard-coded API version with global config #3042
Conversation
Can you explain the rationale here? Would this automatically opt consumers in to a newer version if one were implemented, thus having potential for breakage? Can we be doing better than to call out to the global settings, maybe by passing through as an argument or inferring it (omitting altogether)? If it needs to be overridden externally, perhaps there's another way to achieve this (filters, callbacks) than to put the burden on the component implementer? |
Hi! Our goal is to use Gutenberg with a different REST API URL. We have been able to get that working with these changes to the
Yes. If a newer version of the API were to go live and change the
I looked at trying to do this externally, potentially with Is there was a way for a plugin to inject a request filter into If not, what would that look like? I'm imagining That seems more future-proof but adds a bunch of indirection and work without adding any value to our specific use case. |
Is it not in the interest of exploring if it keeps the implementation simpler for the consumer of A few more general concerns:
As far as enabling overrides, we could follow the pattern of the gutenberg/editor/provider/index.js Lines 101 to 115 in 9150f91
Alternatively, we could explore a pattern for on-request filtering, perhaps using the newly-published (and revisions-pending) hooks module. |
#3377 changed the |
Description
This changes editor components to use the global
wpApiSettings.versionString
instead of hardcoding "wp/v2/". This is the same approach used in lib/client-assets.phpHow Has This Been Tested?
Tested by creating a post and confirming it published correctly.
Screenshots (jpeg or gifs if applicable):
Types of changes
Checklist: