Deduplicate useGlobalStyles hook code#78577
Conversation
|
Size Change: +21 B (0%) Total Size: 8.04 MB 📦 View Changed
ℹ️ View Unchanged
|
|
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. |
|
Flaky tests detected in 7c4dc65. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26292334248
|
|
Thanks, @jsnajdr! |
After #78508 I was looking at where and why we load the
/wp/v2/global-stylesdata, and noticed that theuseGlobalStylesanduseGlobalStylesContextare identical. The duplication happened after originally adding the code toedit-site, and then starting to use it inedit-postandeditor. The final consolidation never happened.This PR unifies both hooks into
useGlobalStyles. TheuseGlobalStylesContextname is not very good, because there is no React context or provider involved. Maybe it used to be there and then was refactored out.