const { isFetching, data: serverGrid } = useFetchGrid(id);
//Always true since serverGrid is not updated after setQueryData
const isDirty = useMemo(() => {
return JSON.stringify(currentGrid) !== JSON.stringify(serverGrid);
}, [currentGrid, serverGrid]);
const handleSaveGridAction = async (): Promise<void> => {
if (!currentGrid) return;
updateGridMutation.mutate(currentGrid, {
onSuccess: (grid: IGrid) => {
setCurrentGrid(grid);
},
});
};
const { isFetching, data: serverGrid } = useFetchGrid(id);
//Always true since serverGrid is not updated after setQueryData
const isDirty = useMemo(() => {
return JSON.stringify(currentGrid) !== JSON.stringify(serverGrid);
}, [currentGrid, serverGrid]);
const handleSaveGridAction = async (): Promise<void> => {
if (!currentGrid) return;
updateGridMutation.mutate(currentGrid, {
onSuccess: (grid: IGrid) => {
setCurrentGrid(grid);
},
});
};