Fix/table rerenders (#609)

* Fixed top bar rerenders

* Fixed rerender on editable cell

* Fix lint

* asd

* Fix

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau
2023-07-12 05:51:24 +02:00
committed by GitHub
parent b5de2abd48
commit 5e0e449e4c
17 changed files with 211 additions and 126 deletions

View File

@ -0,0 +1,17 @@
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
type OwnProps = {
onAddButtonClick?: () => void;
};
export function TopBarHotkeys({ onAddButtonClick }: OwnProps) {
useScopedHotkeys(
'c',
() => onAddButtonClick?.(),
InternalHotkeysScope.Table,
[onAddButtonClick],
);
return <></>;
}

View File

@ -1,8 +1,6 @@
import { ReactNode } from 'react';
import styled from '@emotion/styled';
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { IconPlus } from '@/ui/icons/index';
import NavCollapseButton from '../navbar/NavCollapseButton';
@ -51,8 +49,6 @@ type OwnProps = {
};
export function TopBar({ title, icon, onAddButtonClick }: OwnProps) {
useScopedHotkeys('c', () => onAddButtonClick?.(), InternalHotkeysScope.Table);
return (
<>
<TopBarContainer>