From 19aff5f9fdbbf5fbcf7cc8879811719374a27498 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Mon, 5 Jul 2021 16:18:28 +1000 Subject: [PATCH] TextEditor: fix values not saving in react 17 (thanks @oliviertassinari ) https://github.com/mui-org/material-ui/issues/25560#issuecomment-811465881 https://github.com/facebook/react/pull/17925 --- www/src/components/Table/editors/TextEditor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/src/components/Table/editors/TextEditor.tsx b/www/src/components/Table/editors/TextEditor.tsx index 97207e6df..ff64bbf95 100644 --- a/www/src/components/Table/editors/TextEditor.tsx +++ b/www/src/components/Table/editors/TextEditor.tsx @@ -1,4 +1,4 @@ -import { useRef, useEffect } from "react"; +import { useRef, useLayoutEffect } from "react"; import { EditorProps } from "react-data-grid"; import { makeStyles, createStyles, TextField } from "@material-ui/core"; @@ -47,7 +47,7 @@ export default function TextEditor({ row, column }: EditorProps) { const inputRef = useRef(null); - useEffect(() => { + useLayoutEffect(() => { return () => { const newValue = inputRef.current?.value; if (newValue !== undefined && updateCell) {