consider start & after load as saved

This commit is contained in:
Michael Peters 2024-07-21 00:26:21 -07:00
parent 1f243efc5f
commit 939c402cb4
2 changed files with 8 additions and 3 deletions

View File

@ -1 +1 @@
[{"x0":500,"y0":680,"x1":1080,"y1":360,"stroke":"#007acc"},{"x0":620,"y0":300,"x1":1100,"y1":720,"stroke":"#007acc"},{"x0":420,"y0":480,"x1":780,"y1":740,"stroke":"#007acc"}]
[{"x0":480,"y0":600,"x1":880,"y1":420,"stroke":"#007acc"},{"x0":480,"y0":340,"x1":780,"y1":700,"stroke":"#007acc"},{"x0":300,"y0":540,"x1":660,"y1":360,"stroke":"#007acc"},{"x0":380,"y0":380,"x1":480,"y1":760,"stroke":"#007acc"}]

View File

@ -13,6 +13,7 @@ import {
startPointState,
DrawMode,
drawModePreClipboardState,
ColoredLine,
} from '../../atoms';
import './grid-config.scss';
@ -320,9 +321,10 @@ const StateConfig: FC = () => {
null
);
const [saved, setSaved] = useState<boolean>(true);
const [savedLines, setSavedLines] = useState<ColoredLine[]>(lines);
useEffect(() => {
setSaved(false);
}, [lines]);
setSaved(lines === savedLines);
}, [lines, savedLines]);
const [onOpen, onOpenErrShaking, onOpenPending] =
useAsyncVoidCallback(async () => {
@ -339,6 +341,9 @@ const StateConfig: FC = () => {
]);
setRedoActions([]);
setStartPoint(null);
setSaved(true);
setSavedLines(newLines);
}, []);
const [onSave, onSaveErrShaking, onSavePending] =