about summary refs log tree commit diff
path: root/src/state/shell
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-09-05 18:39:28 +0300
committerGitHub <noreply@github.com>2025-09-05 08:39:28 -0700
commitdaed047bb41bcdac374398b06f87895511ea34a8 (patch)
tree559fa4d9c0d65eb4fd0c8269ee53a73e5a0d7934 /src/state/shell
parentee3e08393882a9d72ae9cab5f765ed2885c5a98d (diff)
downloadvoidsky-daed047bb41bcdac374398b06f87895511ea34a8.tar.zst
[Perf] Drawer gesture perf fix + related cleanup (#8953)
* split drawer layout into own component

* don't put props in dep array

* memoize pager view
Diffstat (limited to 'src/state/shell')
-rw-r--r--src/state/shell/drawer-open.tsx12
1 files changed, 6 insertions, 6 deletions
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<StateContext>(false)
+const stateContext = createContext<StateContext>(false)
 stateContext.displayName = 'DrawerOpenStateContext'
-const setContext = React.createContext<SetContext>((_: boolean) => {})
+const setContext = createContext<SetContext>((_: boolean) => {})
 setContext.displayName = 'DrawerOpenSetContext'
 
 export function Provider({children}: React.PropsWithChildren<{}>) {
-  const [state, setState] = React.useState(false)
+  const [state, setState] = useState(false)
 
   return (
     <stateContext.Provider value={state}>
@@ -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)
 }