Skip to content

Commit

Permalink
Fix: Add home icon to the front page in LinkControl results. (#55606)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Oct 25, 2023
1 parent 27d0b53 commit ff62185
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
postList,
category,
file,
home,
} from '@wordpress/icons';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
import { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url';
Expand All @@ -31,6 +32,9 @@ function SearchItemIcon( { isURL, suggestion } ) {
icon = globe;
} else if ( suggestion.type in ICONS_MAP ) {
icon = ICONS_MAP[ suggestion.type ];
if ( suggestion.type === 'page' && suggestion.isFrontPage ) {
icon = home;
}
}

if ( icon ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ const handleEntitySearch = async (
export default function useSearchHandler(
suggestionsQuery,
allowDirectEntry,
withCreateSuggestion,
withURLSuggestion
withCreateSuggestion
) {
const { fetchSearchSuggestions, pageOnFront } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
Expand All @@ -128,7 +127,6 @@ export default function useSearchHandler(
{ ...suggestionsQuery, isInitialSuggestions },
fetchSearchSuggestions,
withCreateSuggestion,
withURLSuggestion,
pageOnFront
);
},
Expand All @@ -138,7 +136,6 @@ export default function useSearchHandler(
pageOnFront,
suggestionsQuery,
withCreateSuggestion,
withURLSuggestion,
]
);
}

0 comments on commit ff62185

Please sign in to comment.