Font Awesome v7#200
Open
laravdiemen wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates both the deprecated and current IconPickerControl implementations to use Font Awesome v7, including migrating the Font Awesome GraphQL query from deprecated search to searchPaginated, and updating bundled Font Awesome assets accordingly. It also adds a couple of dependencies to @yardinternet/gutenberg-core to resolve local linking/symlink issues.
Changes:
- Migrated Font Awesome GraphQL queries from
search(v6) tosearchPaginated(v7) and adapted response handling to the new schema. - Updated the deprecated icon picker’s bundled Font Awesome stylesheet from SCSS import to a v7 minified CSS asset.
- Added
create-emotionandinvariantdependencies topackages/deprecated/core.
Reviewed changes
Copilot reviewed 4 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/deprecated/editor-components/src/icon-picker-control/index.js | Switches to FA v7 searchPaginated, updates parsing/mapping to classnames, and imports the new CSS bundle. |
| packages/deprecated/editor-components/src/icon-picker-control/assets/scss/all.min.css | Adds the Font Awesome v7 minified CSS bundle (and corresponding @font-face references). |
| packages/deprecated/core/package.json | Adds create-emotion and invariant dependencies (symlink workaround). |
| packages/components/src/icon-picker-control/utils/api.js | Updates the shared API helper to query FA v7 via searchPaginated and request familyStylesByLicense. |
| packages/components/src/icon-picker-control/index.jsx | Updates response traversal to searchPaginated.icons and adds __nextHasNoMarginBottom to SearchControl. |
| package-lock.json | Locks new dependencies and transitive packages introduced by create-emotion / invariant. |
Comments suppressed due to low confidence (2)
packages/deprecated/editor-components/src/icon-picker-control/index.js:50
response.data.searchPaginated.icons.reduce(...)will throw if the API response shape changes orsearchPaginated/iconsis missing. Since this is user-driven input, it’s safer to default to an empty array and still update state (so the UI can show “no icons found” instead of crashing).
packages/components/src/icon-picker-control/index.jsx:79- Using optional chaining on
.reduce()can yieldresult === undefinedwhensearchPaginated/iconsis missing, and the function then returns without updating state or opening the popover—leaving the user with no feedback. Defaultingiconsto an empty array avoids this silent failure and still allows the UI to render the “no icons found” message.
const result = response?.data?.searchPaginated?.icons?.reduce(
( iconResults, iconData ) => {
convertResponseToClassnames(
iconData,
allowedFamilyStyles
).forEach( ( value ) => {
iconResults.push( value );
} );
return iconResults;
},
[]
);
if ( ! result ) return;
setSearchResults( result );
setOpen( true );
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
84
to
+88
| const convertResponseToClassnames = ( response ) => { | ||
| return response.styles | ||
| .filter( ( style ) => allowedStyles.includes( style ) ?? false ) | ||
| .map( ( style ) => `fa-${ style } fa-${ response.id }` ); | ||
| const { free, pro } = response.familyStylesByLicense; | ||
| const seen = new Set(); | ||
| const familyStyles = [ ...free, ...pro ].filter( ( style ) => { | ||
| const key = `${ style.family }:${ style.style }`; |
Comment on lines
53
to
+56
| const getFontAwesomeIcons = ( search ) => { | ||
| const query = `{ search(version: "6.x", first: 100, query: "${ search }") { id styles } }`; | ||
| const query = `{ searchPaginated(version: "7.x", pageSize: 50, query: "${ search }") | ||
| { | ||
| icons { |
Comment on lines
11
to
13
| export const getFontAwesomeIcons = async ( search ) => { | ||
| const query = `{ search(version: "6.x", first: 100, query: "${ search }") | ||
| const query = `{ searchPaginated(version: "7.x", query: "${ search }", pageSize: 50) | ||
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We hebben twee keer een IconPickerControl, eentje voor fusion en eentje voor brave. Beide zijn nu geüpdatet naar Font Awesome 7.
Ik kwam er ook achter dat de
searchdie nu gebruikt was deprecated is dus dat het alternatiefsearchPaginatedis. Voor de brave variant was dit relatief eenvoudig aan te passen, de fusion variant had iets meer werk. Dat komt omdat de allowedStyles daar nog op de oude manier gaan.Ik had problemen met
gutenberg-coresymlinken, het werd opgelost doorcreate-emotioneninvariantaan de package.json toe te voegen.Nadat deze PR gemerged is en nieuwe versies zijn gereleased moet nog het volgende gebeuren (wat dan wel gelijk gedaan moet worden):
yard-gutenbergupdaten met de nieuwste release van@yardinternet/gutenberg-componentsyard-blocksupdaten met nieuwe css file en webfonts +@yardinternet/gutenberg-coreen@yardinternet/gutenberg-editor-componentsnaar de nieuwste release