Skip to content

Conversation

@justlevine
Copy link
Collaborator

@justlevine justlevine commented Aug 24, 2024

What does this implement/fix? Explain your changes.

This PR adds support for exposing the WP_Dependency->extra['group'] field to the Schema. This field is useful for developers trying to imitate WordPress's frontend, and load their assets at the correct point in the rendered document.

Cherrypicked from #3169 (with some changes noted below - @kidunot89 see bd1627b)

What's Included

  • Exposes the EnqueuedAsset.group field, which returns the Int value of $asset->extra['group']
  • Exposes the EnqueuedScript.groupLocation field, which returns a ScriptLoadingGroupEnum corresponding to header/footer scripts. This semantic meaning is for DX simplicity only (WordPress internally uses ints).

Tests (missing from #3169) have been added as well.

Does this close any currently open issues?

Any relevant logs, error output, GraphiQL screenshots, etc?

Any other comments?

This is parceled off from #3169 so it can be reviewed/merged while more investigation continues on the best ways to fix missing assets/dependencies.

Where has this been tested?

Operating System: Ubuntu 20.04 (wsl2+ devilbox + PHP 8.1.14)

WordPress Version: 6.6.1

@coveralls
Copy link

coveralls commented Aug 24, 2024

Coverage Status

coverage: 84.207% (+0.03%) from 84.174%
when pulling cd6c302 on justlevine:feat/asset-group-cherrypick
into 7cb89b5 on wp-graphql:develop.

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit cd6c302 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

View more on Code Climate.

@justlevine justlevine added status: in review Awaiting review before merging or closing needs: reviewer response This needs the attention of a codeowner or maintainer labels Sep 19, 2024
@justlevine
Copy link
Collaborator Author

@jasonbahl putting this on your post 🦃 radar for review 🙏

@jasonbahl jasonbahl merged commit 8cdae0e into wp-graphql:develop Jan 16, 2025
@justlevine justlevine deleted the feat/asset-group-cherrypick branch January 16, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: reviewer response This needs the attention of a codeowner or maintainer status: in review Awaiting review before merging or closing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants