From daed047bb41bcdac374398b06f87895511ea34a8 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 5 Sep 2025 18:39:28 +0300 Subject: [Perf] Drawer gesture perf fix + related cleanup (#8953) * split drawer layout into own component * don't put props in dep array * memoize pager view --- src/state/shell/drawer-open.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/state/shell/drawer-open.tsx') diff --git a/src/state/shell/drawer-open.tsx b/src/state/shell/drawer-open.tsx index 87650a09c..7ce4189c3 100644 --- a/src/state/shell/drawer-open.tsx +++ b/src/state/shell/drawer-open.tsx @@ -1,15 +1,15 @@ -import React from 'react' +import {createContext, useContext, useState} from 'react' type StateContext = boolean type SetContext = (v: boolean) => void -const stateContext = React.createContext(false) +const stateContext = createContext(false) stateContext.displayName = 'DrawerOpenStateContext' -const setContext = React.createContext((_: boolean) => {}) +const setContext = createContext((_: boolean) => {}) setContext.displayName = 'DrawerOpenSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { - const [state, setState] = React.useState(false) + const [state, setState] = useState(false) return ( @@ -19,9 +19,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) { } export function useIsDrawerOpen() { - return React.useContext(stateContext) + return useContext(stateContext) } export function useSetDrawerOpen() { - return React.useContext(setContext) + return useContext(setContext) } -- cgit 1.4.1