From b8fca68db635b45f20271eeba132e3806a52ad05 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 26 Apr 2022 15:25:09 -0700 Subject: [PATCH] grid: pasting shortcodes redirects to app page Current behaviour when pasting, eg. `~paldev/pals` is to show the list of all apps by ~paldev, even though the URL knows we're looking for pals (eg. `/~paldev/apps/pals`). By reconstructing the URL to include the host and desk twice, we can redirect straight to the app prompt, as that's where that route exists. --- pkg/grid/src/nav/Leap.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/grid/src/nav/Leap.tsx b/pkg/grid/src/nav/Leap.tsx index ab2710a0ce..df09f855be 100644 --- a/pkg/grid/src/nav/Leap.tsx +++ b/pkg/grid/src/nav/Leap.tsx @@ -72,7 +72,6 @@ export const Leap = React.forwardRef( useEffect(() => { const newMatch = getMatch(rawInput); - if (newMatch && rawInput) { useLeapStore.setState({ selectedMatch: newMatch }); } @@ -112,7 +111,7 @@ export const Leap = React.forwardRef( const navigateByInput = useCallback( (input: string) => { - const normalizedValue = input.trim().replace(/(~?[\w^_-]{3,13})\//, '$1/apps/'); + const normalizedValue = input.trim().replace(/(~?[\w^_-]{3,13})\//, '$1/apps/$1/'); push(`/leap/${menu}/${normalizedValue}`); }, [menu]