File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
pages/editor/GraphicalEditor/components Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ const holdMap = new Map();
4
4
5
5
export function useValue < T > ( initialState : T , isHold ?: boolean , key ?: string ) {
6
6
const holdKey = key ?? '__value_hold_key__' ;
7
- const fromHoldValue = holdMap . get ( holdKey ) ;
7
+ let fromHoldValue ;
8
+ if ( isHold )
9
+ fromHoldValue = holdMap . get ( holdKey ) ;
8
10
const [ value , setValue ] = useState < T > ( fromHoldValue ?? initialState ) ;
9
11
return {
10
12
_value : value ,
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ export function EffectEditor(props: { json: string; onChange: (newJson: string)
273
273
return effectFields as EffectFields ;
274
274
} , [ ] ) ;
275
275
// 状态:存储所有效果参数的当前值(键为EffectKey,值为数值或undefined)
276
- const effectFields = useValue < EffectFields > ( getInitialFields ( props . json ) , true ) ;
276
+ const effectFields = useValue < EffectFields > ( getInitialFields ( props . json ) , true , "__effect_current" ) ;
277
277
// 当父组件传递的 json 变化时,重新初始化状态
278
278
useEffect ( ( ) => {
279
279
effectFields . value = getInitialFields ( props . json ) ;
You can’t perform that action at this time.
0 commit comments