Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@wordpress/interactivity

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/interactivity - npm Package Compare versions

Comparing version 6.11.0 to 6.12.0

@@ -30,2 +30,13 @@ /**

const nodes = document.querySelectorAll(`[data-${directivePrefix}-interactive]`);
/*
* This `await` with setTimeout is required to apparently ensure that the interactive blocks have their stores
* fully initialized prior to hydrating the blocks. If this is not present, then an error occurs, for example:
* > view.js:46 Uncaught (in promise) ReferenceError: Cannot access 'state' before initialization
* This occurs when splitTask() is implemented with scheduler.yield() as opposed to setTimeout(), as with the former
* split tasks are added to the front of the task queue whereas with the latter they are added to the end of the queue.
*/
await new Promise(resolve => {
setTimeout(resolve, 0);
});
for (const node of nodes) {

@@ -32,0 +43,0 @@ if (!hydratedIslands.has(node)) {

@@ -32,3 +32,4 @@ /* wp:polyfill */

ownKeys: target => [...new Set([...Object.keys(contextObjectToFallback.get(target)), ...Object.keys(target)])],
getOwnPropertyDescriptor: (target, key) => descriptor(target, key) || descriptor(contextObjectToFallback.get(target), key)
getOwnPropertyDescriptor: (target, key) => descriptor(target, key) || descriptor(contextObjectToFallback.get(target), key),
has: (target, key) => Reflect.has(target, key) || Reflect.has(contextObjectToFallback.get(target), key)
};

@@ -35,0 +36,0 @@

@@ -37,3 +37,3 @@ /* wp:polyfill */

*
* @return Promise
* @return Promise<void>
*/

@@ -40,0 +40,0 @@ export const splitTask = typeof window.scheduler?.yield === 'function' ? window.scheduler.yield.bind(window.scheduler) : () => {

@@ -15,3 +15,3 @@ /**

*
* @return Promise
* @return Promise<void>
*/

@@ -18,0 +18,0 @@ export declare const splitTask: () => Promise<unknown>;

@@ -38,2 +38,13 @@ "use strict";

const nodes = document.querySelectorAll(`[data-${_constants.directivePrefix}-interactive]`);
/*
* This `await` with setTimeout is required to apparently ensure that the interactive blocks have their stores
* fully initialized prior to hydrating the blocks. If this is not present, then an error occurs, for example:
* > view.js:46 Uncaught (in promise) ReferenceError: Cannot access 'state' before initialization
* This occurs when splitTask() is implemented with scheduler.yield() as opposed to setTimeout(), as with the former
* split tasks are added to the front of the task queue whereas with the latter they are added to the end of the queue.
*/
await new Promise(resolve => {
setTimeout(resolve, 0);
});
for (const node of nodes) {

@@ -40,0 +51,0 @@ if (!_vdom.hydratedIslands.has(node)) {

@@ -38,3 +38,4 @@ /* wp:polyfill */

ownKeys: target => [...new Set([...Object.keys(contextObjectToFallback.get(target)), ...Object.keys(target)])],
getOwnPropertyDescriptor: (target, key) => descriptor(target, key) || descriptor(contextObjectToFallback.get(target), key)
getOwnPropertyDescriptor: (target, key) => descriptor(target, key) || descriptor(contextObjectToFallback.get(target), key),
has: (target, key) => Reflect.has(target, key) || Reflect.has(contextObjectToFallback.get(target), key)
};

@@ -41,0 +42,0 @@

@@ -55,3 +55,3 @@ /* wp:polyfill */

*
* @return Promise
* @return Promise<void>
*/

@@ -58,0 +58,0 @@ const splitTask = exports.splitTask = typeof window.scheduler?.yield === 'function' ? window.scheduler.yield.bind(window.scheduler) : () => {

@@ -5,2 +5,8 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 6.12.0 (2024-11-16)
### Bug Fixes
- Fix property modification from inherited context two or more levels above ([#66872](https://github.com/WordPress/gutenberg/pull/66872)).
## 6.11.0 (2024-10-30)

@@ -7,0 +13,0 @@

{
"name": "@wordpress/interactivity",
"version": "6.11.0",
"version": "6.12.0",
"description": "Package that provides a standard and simple way to handle the frontend interactivity of Gutenberg blocks.",

@@ -28,3 +28,2 @@ "author": "The WordPress Contributors",

"react-native": "src/index",
"types": "build-types",
"wpScriptModuleExports": {

@@ -34,2 +33,3 @@ ".": "./build-module/index.js",

},
"types": "build-types",
"dependencies": {

@@ -42,3 +42,3 @@ "@preact/signals": "^1.3.0",

},
"gitHead": "dcf4613b33b0eda14e203ac30f700ed0db70347f"
"gitHead": "510540d99f3d222a96f08d3d7b66c9e7a726f705"
}

@@ -36,2 +36,13 @@ /**

/*
* This `await` with setTimeout is required to apparently ensure that the interactive blocks have their stores
* fully initialized prior to hydrating the blocks. If this is not present, then an error occurs, for example:
* > view.js:46 Uncaught (in promise) ReferenceError: Cannot access 'state' before initialization
* This occurs when splitTask() is implemented with scheduler.yield() as opposed to setTimeout(), as with the former
* split tasks are added to the front of the task queue whereas with the latter they are added to the end of the queue.
*/
await new Promise( ( resolve ) => {
setTimeout( resolve, 0 );
} );
for ( const node of nodes ) {

@@ -38,0 +49,0 @@ if ( ! hydratedIslands.has( node ) ) {

@@ -41,2 +41,5 @@ const contextObjectToProxy = new WeakMap();

descriptor( contextObjectToFallback.get( target ), key ),
has: ( target, key ) =>
Reflect.has( target, key ) ||
Reflect.has( contextObjectToFallback.get( target ), key ),
};

@@ -43,0 +46,0 @@

@@ -140,2 +140,20 @@ /**

} );
it( "should modify props inherited from fallback's ancestors", () => {
const ancestor: any = proxifyContext(
{ ancestorProp: 'ancestor' },
{}
);
const fallback: any = proxifyContext(
{ fallbackProp: 'fallback' },
ancestor
);
const context: any = proxifyContext( {}, fallback );
context.ancestorProp = 'modified';
expect( context.ancestorProp ).toBe( 'modified' );
expect( fallback.ancestorProp ).toBe( 'modified' );
expect( ancestor.ancestorProp ).toBe( 'modified' );
} );
} );

@@ -142,0 +160,0 @@

@@ -57,3 +57,3 @@ /**

*
* @return Promise
* @return Promise<void>
*/

@@ -60,0 +60,0 @@ export const splitTask =

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet