Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz authored and samueljseay committed Aug 21, 2024
1 parent c387f9e commit eb31c2f
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,11 @@ export default () => {
const inheritedValue = useContext( inheritedContext );

const ns = defaultEntry!.namespace;
const currentValue = useRef( {
[ ns ]: proxifyState( ns, {} ),
} );
const currentValue = useRef( proxifyState( ns, {} ) );

// No change should be made if `defaultEntry` does not exist.
const contextStack = useMemo( () => {
const result = { ...inheritedValue };
if ( defaultEntry ) {
const { namespace, value } = defaultEntry;
// Check that the value is a JSON object. Send a console warning if not.
Expand All @@ -288,15 +287,16 @@ export default () => {
);
}
updateContext(
currentValue.current[ namespace ],
currentValue.current,
deepClone( value ) as object
);
currentValue.current[ namespace ] = proxifyContext(
currentValue.current[ namespace ],
currentValue.current = proxifyContext(
currentValue.current,
inheritedValue[ namespace ]
);
result[ namespace ] = currentValue.current;
}
return currentValue.current;
return result;
}, [ defaultEntry, inheritedValue ] );

return createElement( Provider, { value: contextStack }, children );
Expand Down

0 comments on commit eb31c2f

Please sign in to comment.