fix: onEnter creating new function page in settings (#7236)

## Description

- This PR solves the issue #7235 
- On pressing enter, it automatically redirected to New function page in
settings
This commit is contained in:
Harshit Singh 2024-09-24 20:13:03 +05:30 committed by GitHub
parent fa241fa4e9
commit 2fedf0d2fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,10 +8,7 @@ import { Table } from '@/ui/layout/table/components/Table';
import { TableBody } from '@/ui/layout/table/components/TableBody';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';
import { Key } from 'ts-key-enum';
import { ServerlessFunction } from '~/generated-metadata/graphql';
import { useHotkeyScopeOnMount } from '~/hooks/useHotkeyScopeOnMount';
@ -25,19 +22,11 @@ const StyledTableBody = styled(TableBody)`
export const SettingsServerlessFunctionsTable = () => {
const { serverlessFunctions } = useGetManyServerlessFunctions();
const navigate = useNavigate();
useHotkeyScopeOnMount(
SettingsServerlessFunctionHotkeyScope.ServerlessFunction,
);
useScopedHotkeys(
[Key.Enter],
() => {
navigate(getSettingsPagePath(SettingsPath.NewServerlessFunction));
},
SettingsServerlessFunctionHotkeyScope.ServerlessFunction,
);
return (
<>
{serverlessFunctions.length ? (