Skip to content

Commit

Permalink
Fix previousScope ref and state
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz committed Dec 4, 2023
1 parent 1cf650a commit 8fb38df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/interactivity/src/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ const Directives = ( {
scope.evaluate = useCallback( getEvaluate( { scope } ), [] );
scope.context = useContext( context );
/* eslint-disable react-hooks/rules-of-hooks */
scope.ref = previousScope.ref || useRef( null );
scope.state = previousScope.state || useRef( deepSignal( {} ) ).current;
scope.ref = previousScope?.ref || useRef( null );
scope.state = previousScope?.state || useRef( deepSignal( {} ) ).current;
/* eslint-enable react-hooks/rules-of-hooks */

// Create a fresh copy of the vnode element and add the props to the scope.
Expand Down

0 comments on commit 8fb38df

Please sign in to comment.