diff --git a/src/runtime/components.js b/src/runtime/components.js index 8edcf5f4..acc75298 100644 --- a/src/runtime/components.js +++ b/src/runtime/components.js @@ -4,7 +4,7 @@ import { component } from './hooks'; export default () => { const WpContext = ({ children, data, context: { Provider } }) => { - const signals = useMemo(() => deepSignal(JSON.parse(data)), []); + const signals = useMemo(() => deepSignal(JSON.parse(data)), [data]); return {children}; }; component('wp-context', WpContext); diff --git a/src/runtime/directives.js b/src/runtime/directives.js index 5741046d..742b3260 100644 --- a/src/runtime/directives.js +++ b/src/runtime/directives.js @@ -17,11 +17,13 @@ export default () => { directive( 'context', ({ - directives: { context }, + directives: { + context: { default: context }, + }, props: { children }, context: { Provider }, }) => { - const signals = useMemo(() => deepSignal(context.default), []); + const signals = useMemo(() => deepSignal(context), [context]); return {children}; } );