From e40447e274390fa76ae01d2db19be2dc7db6504f Mon Sep 17 00:00:00 2001 From: David Arenas Date: Thu, 5 Sep 2024 18:35:24 +0200 Subject: [PATCH] Interactivity API: Prevent calling `proxifyContext` over an already-proxified context inside the `wp-context` directive (#65090) * Do not store the proxified context inside `currentValue.current`. * Update changelog Co-authored-by: DAreRodz Co-authored-by: gziolo --- packages/interactivity/CHANGELOG.md | 4 ++++ packages/interactivity/src/directives.tsx | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/interactivity/CHANGELOG.md b/packages/interactivity/CHANGELOG.md index b410eb270358f..b888f159c0086 100644 --- a/packages/interactivity/CHANGELOG.md +++ b/packages/interactivity/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fixes + +- Prevent calling `proxifyContext` over an already-proxified context inside `wp-context` ([#65090](https://github.com/WordPress/gutenberg/pull/65090)). + ## 6.7.0 (2024-09-05) ### Enhancements diff --git a/packages/interactivity/src/directives.tsx b/packages/interactivity/src/directives.tsx index 715bc2ea7b16b..b41d50722e376 100644 --- a/packages/interactivity/src/directives.tsx +++ b/packages/interactivity/src/directives.tsx @@ -290,11 +290,10 @@ export default () => { currentValue.current, deepClone( value ) as object ); - currentValue.current = proxifyContext( + result[ namespace ] = proxifyContext( currentValue.current, inheritedValue[ namespace ] ); - result[ namespace ] = currentValue.current; } return result; }, [ defaultEntry, inheritedValue ] );