Skip to content

Commit

Permalink
Fix sonar cloud issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed Dec 3, 2024
1 parent 25c2f8b commit 3187dbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client/src/pages/detail/formDirtyContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useState } from "react";
import React, { createContext, useMemo, useState } from "react";

interface FormDirtyContextType {
isFormDirty: boolean;
Expand All @@ -9,6 +9,6 @@ export const FormDirtyContext = createContext<FormDirtyContextType | undefined>(

export const FormDirtyProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const [isFormDirty, setIsFormDirty] = useState(false);

return <FormDirtyContext.Provider value={{ isFormDirty, setIsFormDirty }}>{children}</FormDirtyContext.Provider>;
const value = useMemo(() => ({ isFormDirty, setIsFormDirty }), [isFormDirty]);
return <FormDirtyContext.Provider value={value}>{children}</FormDirtyContext.Provider>;
};

0 comments on commit 3187dbd

Please sign in to comment.