Merge pull request #5738 from urbit/mp/grid/shortcode-redirects

grid: pasting shortcodes redirects to app page
This commit is contained in:
Hunter Miller 2022-05-02 10:46:17 -05:00 committed by GitHub
commit 2b8ad871bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,7 +72,6 @@ export const Leap = React.forwardRef(
useEffect(() => { useEffect(() => {
const newMatch = getMatch(rawInput); const newMatch = getMatch(rawInput);
if (newMatch && rawInput) { if (newMatch && rawInput) {
useLeapStore.setState({ selectedMatch: newMatch }); useLeapStore.setState({ selectedMatch: newMatch });
} }
@ -112,7 +111,7 @@ export const Leap = React.forwardRef(
const navigateByInput = useCallback( const navigateByInput = useCallback(
(input: string) => { (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}`); push(`/leap/${menu}/${normalizedValue}`);
}, },
[menu] [menu]