From 0ebe6292a310c19e7a4353fe9701a58bd7253896 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Fri, 9 Dec 2022 00:19:44 +0800 Subject: [PATCH] chore: add display name to context providers (#5974) * chore: add display name to context providers * fix typo --- src/components/App.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index ea2f3bf9..347bb6fe 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -285,18 +285,21 @@ const deviceContextInitialValue = { canDeviceFitSidebar: false, }; const DeviceContext = React.createContext(deviceContextInitialValue); +DeviceContext.displayName = "DeviceContext"; export const useDevice = () => useContext(DeviceContext); const ExcalidrawContainerContext = React.createContext<{ container: HTMLDivElement | null; id: string | null; }>({ container: null, id: null }); +ExcalidrawContainerContext.displayName = "ExcalidrawContainerContext"; export const useExcalidrawContainer = () => useContext(ExcalidrawContainerContext); const ExcalidrawElementsContext = React.createContext< readonly NonDeletedExcalidrawElement[] >([]); +ExcalidrawElementsContext.displayName = "ExcalidrawElementsContext"; const ExcalidrawAppStateContext = React.createContext({ ...getDefaultAppState(), @@ -305,17 +308,19 @@ const ExcalidrawAppStateContext = React.createContext({ offsetLeft: 0, offsetTop: 0, }); +ExcalidrawAppStateContext.displayName = "ExcalidrawAppStateContext"; -const ExcalidrawSetAppStateContent = React.createContext< +const ExcalidrawSetAppStateContext = React.createContext< React.Component["setState"] >(() => {}); +ExcalidrawSetAppStateContext.displayName = "ExcalidrawSetAppStateContext"; export const useExcalidrawElements = () => useContext(ExcalidrawElementsContext); export const useExcalidrawAppState = () => useContext(ExcalidrawAppStateContext); export const useExcalidrawSetAppState = () => - useContext(ExcalidrawSetAppStateContent); + useContext(ExcalidrawSetAppStateContext); let didTapTwice: boolean = false; let tappedTwiceTimer = 0; @@ -553,7 +558,7 @@ class App extends React.Component { value={this.excalidrawContainerValue} > - + {
{this.renderCanvas()}
{" "}
-
+