-
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
Use apiFetch instead of window.fetch #50043
Conversation
Size Change: +64 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
cc @youknowriad, since you added this originally. |
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 compared the output of this API in trunk to the output with this patch applied, and the output looks identical. I think we can merge it.
let template; | ||
try { | ||
template = await window |
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 don't recall exactly why initially apiFetch didn't work for me 🤔 I wonder what changed.
cb2bdd7
to
aec5367
Compare
What?
This replaces the native use of window.fetch with a a call to apiFetch, so that it uses the Gutenberg functions.
🤖 Generated by Copilot at cb2bdd7
Refactored
core-data
package to useapiFetch
for all REST API requests. This improves data fetching consistency and reliability, and enables future endpoint enhancements.Why?
This means that this when changes are made to the REST API (for example https://github.com/WordPress/gutenberg/pull/50030/files), this API call will also be updated.
How?
Replace window.fetch with apiFetch.
🤖 Generated by Copilot at cb2bdd7
core-data
package to use theapiFetch
utility instead of thewindow.fetch
API (link, FTesting Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Co-authored-by: Maggie 3593343+MaggieCabrera@users.noreply.github.com