Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
filip131311 committed Dec 20, 2024
1 parent 81d8093 commit 10a41ba
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, PropsWithChildren, useContext, useEffect, useState } from "react";
import { createContext, PropsWithChildren, useContext, useEffect, useMemo, useState } from "react";
import { useUtils } from "./UtilsProvider";

type TelemetryContextProps = { telemetryEnabled: boolean };
Expand All @@ -18,9 +18,9 @@ export function TelemetryProvider({ children }: PropsWithChildren) {
};
}, []);

return (
<TelemetryContext.Provider value={{ telemetryEnabled }}>{children}</TelemetryContext.Provider>
);
const contextValue = useMemo(() => ({ telemetryEnabled }), [telemetryEnabled]);

return <TelemetryContext.Provider value={contextValue}>{children}</TelemetryContext.Provider>;
}

export function useTelemetry() {
Expand Down

0 comments on commit 10a41ba

Please sign in to comment.