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

@ -1,9 +1,9 @@
import styled from '@emotion/styled';
import { useIsSoftFocusOnCurrentCell } from './hooks/useIsSoftFocusOnCurrentCell';
import { useSetSoftFocusOnCurrentCell } from './hooks/useSetSoftFocusOnCurrentCell';
type Props = {
softFocus: boolean;
softFocus?: boolean;
};
export const EditableCellNormalModeOuterContainer = styled.div<Props>`
@ -35,10 +35,14 @@ export const EditableCellNormalModeInnerContainer = styled.div`
export function EditableCellDisplayMode({
children,
}: React.PropsWithChildren<unknown>) {
const hasSoftFocus = useIsSoftFocusOnCurrentCell();
const setSoftFocusOnCurrentCell = useSetSoftFocusOnCurrentCell();
function handleOnClick() {
setSoftFocusOnCurrentCell();
}
return (
<EditableCellNormalModeOuterContainer softFocus={hasSoftFocus}>
<EditableCellNormalModeOuterContainer onClick={handleOnClick}>
<EditableCellNormalModeInnerContainer>
{children}
</EditableCellNormalModeInnerContainer>