Skip to content

Commit 7326c29

Browse files
committed
Fix back button
1 parent 55e17b1 commit 7326c29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ui/pages/Search/Search.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ export function Search() {
230230

231231
const items = normalizedQuery ? searchItems : recentItems;
232232

233+
/**
234+
* We provide link-like behavior for fungible items for both click and keyboard navigation.
235+
* For the click event we pass this function to the onClick handler on the SurfaceLinkItem.
236+
* For keyboard navigation, we use the onSelectedItemChange from the combobox params.
237+
* In the onSelectedItemChange we also call navigate function to provide routing to the asset page
238+
*/
233239
const handleFungibleClick = useCallback(
234240
(fungibleId: string) => {
235241
if (preferences) {
@@ -245,9 +251,8 @@ export function Search() {
245251
pathname,
246252
section: 'Search',
247253
});
248-
navigate(`/asset/${fungibleId}`);
249254
},
250-
[navigate, pathname, preferences, setPreferences]
255+
[pathname, preferences, setPreferences]
251256
);
252257

253258
const { getItemProps, getInputProps, getMenuProps, highlightedIndex } =
@@ -265,6 +270,7 @@ export function Search() {
265270
return;
266271
}
267272
handleFungibleClick(fungibleId);
273+
navigate(`/asset/${fungibleId}`);
268274
},
269275
stateReducer: (state, actionAndChanges) => {
270276
const { changes, type } = actionAndChanges;

0 commit comments

Comments
 (0)