File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1- import { type ReactNode , useState } from 'react'
1+ import { type ReactNode , useMemo , useState } from 'react'
22import type { ClassState } from './stateTypes'
33import { THUNK_CONTEXT_MAP } from './thunkContextMap'
44
@@ -22,8 +22,16 @@ const ThunkContext = (props: Props) => {
2222 // biome-ignore lint/correctness/useHookAtTopLevel: the order is fixed.
2323 // biome-ignore lint/suspicious/noExplicitAny: This generalized state can be any type.
2424 const [ classState , setClassState ] = useState < ClassState < any > > ( { myClass : theClass , nodes : { } } )
25+
2526 refClassState . current = classState
26- const value = { refClassState, setClassState }
27+ // biome-ignore lint/correctness/useHookAtTopLevel: the order is fixed.
28+ const value = useMemo (
29+ ( ) => ( {
30+ refClassState,
31+ setClassState,
32+ } ) ,
33+ [ classState ] ,
34+ )
2735
2836 const theChildren =
2937 classes . length === 1 ? children : ThunkContext ( { classes : classes . slice ( 1 ) , children } )
You can’t perform that action at this time.
0 commit comments