fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=emotion.d.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/utils/hooks/emotion.d.ts"],"sourcesContent":["import type { EmotionCache } from '@emotion/utils';\n\ndeclare module '@emotion/react' {\n\texport function __unsafe_useEmotionCache(): EmotionCache | null;\n}\n"],"mappings":""}

View File

@@ -0,0 +1,6 @@
export { default as useControlledState } from './use-controlled-state';
export { default as useUpdateEffect } from './use-update-effect';
export { useControlledValue } from './use-controlled-value';
export { useCx } from './use-cx';
export { useLatestRef } from './use-latest-ref';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["default","useControlledState","useUpdateEffect","useControlledValue","useCx","useLatestRef"],"sources":["@wordpress/components/src/utils/hooks/index.js"],"sourcesContent":["export { default as useControlledState } from './use-controlled-state';\nexport { default as useUpdateEffect } from './use-update-effect';\nexport { useControlledValue } from './use-controlled-value';\nexport { useCx } from './use-cx';\nexport { useLatestRef } from './use-latest-ref';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,kBAAkB,QAAQ,wBAAwB;AACtE,SAASD,OAAO,IAAIE,eAAe,QAAQ,qBAAqB;AAChE,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,YAAY,QAAQ,kBAAkB"}

View File

@@ -0,0 +1,84 @@
/**
* WordPress dependencies
*/
import { useEffect, useState, useCallback } from '@wordpress/element';
/**
* Internal dependencies
*/
import { isValueDefined, getDefinedValue } from '../values';
/**
* @template T
* @typedef Options
* @property {T} [initial] Initial value
* @property {T | ""} fallback Fallback value
*/
/** @type {Readonly<{ initial: undefined, fallback: '' }>} */
const defaultOptions = {
initial: undefined,
/**
* Defaults to empty string, as that is preferred for usage with
* <input />, <textarea />, and <select /> form elements.
*/
fallback: ''
};
/**
* Custom hooks for "controlled" components to track and consolidate internal
* state and incoming values. This is useful for components that render
* `input`, `textarea`, or `select` HTML elements.
*
* https://reactjs.org/docs/forms.html#controlled-components
*
* At first, a component using useControlledState receives an initial prop
* value, which is used as initial internal state.
*
* This internal state can be maintained and updated without
* relying on new incoming prop values.
*
* Unlike the basic useState hook, useControlledState's state can
* be updated if a new incoming prop value is changed.
*
* @template T
*
* @param {T | undefined} currentState The current value.
* @param {Options<T>} [options=defaultOptions] Additional options for the hook.
*
* @return {[T | "", (nextState: T) => void]} The controlled value and the value setter.
*/
function useControlledState(currentState, options = defaultOptions) {
const {
initial,
fallback
} = {
...defaultOptions,
...options
};
const [internalState, setInternalState] = useState(currentState);
const hasCurrentState = isValueDefined(currentState);
/*
* Resets internal state if value every changes from uncontrolled <-> controlled.
*/
useEffect(() => {
if (hasCurrentState && internalState) {
setInternalState(undefined);
}
}, [hasCurrentState, internalState]);
const state = getDefinedValue([currentState, internalState, initial], fallback);
/* eslint-disable jsdoc/no-undefined-types */
/** @type {(nextState: T) => void} */
const setState = useCallback(nextState => {
if (!hasCurrentState) {
setInternalState(nextState);
}
}, [hasCurrentState]);
/* eslint-enable jsdoc/no-undefined-types */
return [state, setState];
}
export default useControlledState;
//# sourceMappingURL=use-controlled-state.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useEffect","useState","useCallback","isValueDefined","getDefinedValue","defaultOptions","initial","undefined","fallback","useControlledState","currentState","options","internalState","setInternalState","hasCurrentState","state","setState","nextState"],"sources":["@wordpress/components/src/utils/hooks/use-controlled-state.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { isValueDefined, getDefinedValue } from '../values';\n\n/**\n * @template T\n * @typedef Options\n * @property {T} [initial] Initial value\n * @property {T | \"\"} fallback Fallback value\n */\n\n/** @type {Readonly<{ initial: undefined, fallback: '' }>} */\nconst defaultOptions = {\n\tinitial: undefined,\n\t/**\n\t * Defaults to empty string, as that is preferred for usage with\n\t * <input />, <textarea />, and <select /> form elements.\n\t */\n\tfallback: '',\n};\n\n/**\n * Custom hooks for \"controlled\" components to track and consolidate internal\n * state and incoming values. This is useful for components that render\n * `input`, `textarea`, or `select` HTML elements.\n *\n * https://reactjs.org/docs/forms.html#controlled-components\n *\n * At first, a component using useControlledState receives an initial prop\n * value, which is used as initial internal state.\n *\n * This internal state can be maintained and updated without\n * relying on new incoming prop values.\n *\n * Unlike the basic useState hook, useControlledState's state can\n * be updated if a new incoming prop value is changed.\n *\n * @template T\n *\n * @param {T | undefined} currentState The current value.\n * @param {Options<T>} [options=defaultOptions] Additional options for the hook.\n *\n * @return {[T | \"\", (nextState: T) => void]} The controlled value and the value setter.\n */\nfunction useControlledState( currentState, options = defaultOptions ) {\n\tconst { initial, fallback } = { ...defaultOptions, ...options };\n\n\tconst [ internalState, setInternalState ] = useState( currentState );\n\tconst hasCurrentState = isValueDefined( currentState );\n\n\t/*\n\t * Resets internal state if value every changes from uncontrolled <-> controlled.\n\t */\n\tuseEffect( () => {\n\t\tif ( hasCurrentState && internalState ) {\n\t\t\tsetInternalState( undefined );\n\t\t}\n\t}, [ hasCurrentState, internalState ] );\n\n\tconst state = getDefinedValue(\n\t\t[ currentState, internalState, initial ],\n\t\tfallback\n\t);\n\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {(nextState: T) => void} */\n\tconst setState = useCallback(\n\t\t( nextState ) => {\n\t\t\tif ( ! hasCurrentState ) {\n\t\t\t\tsetInternalState( nextState );\n\t\t\t}\n\t\t},\n\t\t[ hasCurrentState ]\n\t);\n\t/* eslint-enable jsdoc/no-undefined-types */\n\n\treturn [ state, setState ];\n}\n\nexport default useControlledState;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,oBAAoB;;AAErE;AACA;AACA;AACA,SAASC,cAAc,EAAEC,eAAe,QAAQ,WAAW;;AAE3D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMC,cAAc,GAAG;EACtBC,OAAO,EAAEC,SAAS;EAClB;AACD;AACA;AACA;EACCC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAEC,YAAY,EAAEC,OAAO,GAAGN,cAAc,EAAG;EACrE,MAAM;IAAEC,OAAO;IAAEE;EAAS,CAAC,GAAG;IAAE,GAAGH,cAAc;IAAE,GAAGM;EAAQ,CAAC;EAE/D,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGZ,QAAQ,CAAES,YAAa,CAAC;EACpE,MAAMI,eAAe,GAAGX,cAAc,CAAEO,YAAa,CAAC;;EAEtD;AACD;AACA;EACCV,SAAS,CAAE,MAAM;IAChB,IAAKc,eAAe,IAAIF,aAAa,EAAG;MACvCC,gBAAgB,CAAEN,SAAU,CAAC;IAC9B;EACD,CAAC,EAAE,CAAEO,eAAe,EAAEF,aAAa,CAAG,CAAC;EAEvC,MAAMG,KAAK,GAAGX,eAAe,CAC5B,CAAEM,YAAY,EAAEE,aAAa,EAAEN,OAAO,CAAE,EACxCE,QACD,CAAC;;EAED;EACA;EACA,MAAMQ,QAAQ,GAAGd,WAAW,CACzBe,SAAS,IAAM;IAChB,IAAK,CAAEH,eAAe,EAAG;MACxBD,gBAAgB,CAAEI,SAAU,CAAC;IAC9B;EACD,CAAC,EACD,CAAEH,eAAe,CAClB,CAAC;EACD;;EAEA,OAAO,CAAEC,KAAK,EAAEC,QAAQ,CAAE;AAC3B;AAEA,eAAeP,kBAAkB"}

View File

@@ -0,0 +1,36 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
/**
* Simplified and improved implementation of useControlledState.
*
* @param props
* @param props.defaultValue
* @param props.value
* @param props.onChange
* @return The controlled value and the value setter.
*/
export function useControlledValue({
defaultValue,
onChange,
value: valueProp
}) {
const hasValue = typeof valueProp !== 'undefined';
const initialValue = hasValue ? valueProp : defaultValue;
const [state, setState] = useState(initialValue);
const value = hasValue ? valueProp : state;
let setValue;
if (hasValue && typeof onChange === 'function') {
setValue = onChange;
} else if (!hasValue && typeof onChange === 'function') {
setValue = nextValue => {
onChange(nextValue);
setState(nextValue);
};
} else {
setValue = setState;
}
return [value, setValue];
}
//# sourceMappingURL=use-controlled-value.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useState","useControlledValue","defaultValue","onChange","value","valueProp","hasValue","initialValue","state","setState","setValue","nextValue"],"sources":["@wordpress/components/src/utils/hooks/use-controlled-value.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\ntype Props< T > = {\n\tdefaultValue?: T;\n\tvalue?: T;\n\tonChange?: ( value: T ) => void;\n};\n\n/**\n * Simplified and improved implementation of useControlledState.\n *\n * @param props\n * @param props.defaultValue\n * @param props.value\n * @param props.onChange\n * @return The controlled value and the value setter.\n */\nexport function useControlledValue< T >( {\n\tdefaultValue,\n\tonChange,\n\tvalue: valueProp,\n}: Props< T > ) {\n\tconst hasValue = typeof valueProp !== 'undefined';\n\tconst initialValue = hasValue ? valueProp : defaultValue;\n\tconst [ state, setState ] = useState( initialValue );\n\tconst value = hasValue ? valueProp : state;\n\n\tlet setValue: ( nextValue: T ) => void;\n\tif ( hasValue && typeof onChange === 'function' ) {\n\t\tsetValue = onChange;\n\t} else if ( ! hasValue && typeof onChange === 'function' ) {\n\t\tsetValue = ( nextValue ) => {\n\t\t\tonChange( nextValue );\n\t\t\tsetState( nextValue );\n\t\t};\n\t} else {\n\t\tsetValue = setState;\n\t}\n\n\treturn [ value, setValue as typeof setState ] as const;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAQ7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAO;EACxCC,YAAY;EACZC,QAAQ;EACRC,KAAK,EAAEC;AACI,CAAC,EAAG;EACf,MAAMC,QAAQ,GAAG,OAAOD,SAAS,KAAK,WAAW;EACjD,MAAME,YAAY,GAAGD,QAAQ,GAAGD,SAAS,GAAGH,YAAY;EACxD,MAAM,CAAEM,KAAK,EAAEC,QAAQ,CAAE,GAAGT,QAAQ,CAAEO,YAAa,CAAC;EACpD,MAAMH,KAAK,GAAGE,QAAQ,GAAGD,SAAS,GAAGG,KAAK;EAE1C,IAAIE,QAAkC;EACtC,IAAKJ,QAAQ,IAAI,OAAOH,QAAQ,KAAK,UAAU,EAAG;IACjDO,QAAQ,GAAGP,QAAQ;EACpB,CAAC,MAAM,IAAK,CAAEG,QAAQ,IAAI,OAAOH,QAAQ,KAAK,UAAU,EAAG;IAC1DO,QAAQ,GAAKC,SAAS,IAAM;MAC3BR,QAAQ,CAAEQ,SAAU,CAAC;MACrBF,QAAQ,CAAEE,SAAU,CAAC;IACtB,CAAC;EACF,CAAC,MAAM;IACND,QAAQ,GAAGD,QAAQ;EACpB;EAEA,OAAO,CAAEL,KAAK,EAAEM,QAAQ,CAAqB;AAC9C"}

View File

@@ -0,0 +1,55 @@
/**
* External dependencies
*/
import { __unsafe_useEmotionCache as useEmotionCache } from '@emotion/react';
import { insertStyles } from '@emotion/utils';
// eslint-disable-next-line no-restricted-imports
// eslint-disable-next-line no-restricted-imports
import { cx as innerCx } from '@emotion/css';
/**
* WordPress dependencies
*/
import { useCallback } from '@wordpress/element';
const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name', 'styles'].every(p => typeof o[p] !== 'undefined');
/**
* Retrieve a `cx` function that knows how to handle `SerializedStyles`
* returned by the `@emotion/react` `css` function in addition to what
* `cx` normally knows how to handle. It also hooks into the Emotion
* Cache, allowing `css` calls to work inside iframes.
*
* ```jsx
* import { css } from '@emotion/react';
*
* const styles = css`
* color: red
* `;
*
* function RedText( { className, ...props } ) {
* const cx = useCx();
*
* const classes = cx(styles, className);
*
* return <span className={classes} {...props} />;
* }
* ```
*/
export const useCx = () => {
const cache = useEmotionCache();
const cx = useCallback((...classNames) => {
if (cache === null) {
throw new Error('The `useCx` hook should be only used within a valid Emotion Cache Context');
}
return innerCx(...classNames.map(arg => {
if (isSerializedStyles(arg)) {
insertStyles(cache, arg, false);
return `${cache.key}-${arg.name}`;
}
return arg;
}));
}, [cache]);
return cx;
};
//# sourceMappingURL=use-cx.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["__unsafe_useEmotionCache","useEmotionCache","insertStyles","cx","innerCx","useCallback","isSerializedStyles","o","every","p","useCx","cache","classNames","Error","map","arg","key","name"],"sources":["@wordpress/components/src/utils/hooks/use-cx.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { __unsafe_useEmotionCache as useEmotionCache } from '@emotion/react';\nimport type { SerializedStyles } from '@emotion/serialize';\nimport { insertStyles } from '@emotion/utils';\n// eslint-disable-next-line no-restricted-imports\nimport type { ClassNamesArg } from '@emotion/css';\n// eslint-disable-next-line no-restricted-imports\nimport { cx as innerCx } from '@emotion/css';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\n\nconst isSerializedStyles = ( o: any ): o is SerializedStyles =>\n\ttypeof o !== 'undefined' &&\n\to !== null &&\n\t[ 'name', 'styles' ].every( ( p ) => typeof o[ p ] !== 'undefined' );\n\n/**\n * Retrieve a `cx` function that knows how to handle `SerializedStyles`\n * returned by the `@emotion/react` `css` function in addition to what\n * `cx` normally knows how to handle. It also hooks into the Emotion\n * Cache, allowing `css` calls to work inside iframes.\n *\n * ```jsx\n * import { css } from '@emotion/react';\n *\n * const styles = css`\n * \tcolor: red\n * `;\n *\n * function RedText( { className, ...props } ) {\n * \tconst cx = useCx();\n *\n * \tconst classes = cx(styles, className);\n *\n * \treturn <span className={classes} {...props} />;\n * }\n * ```\n */\nexport const useCx = () => {\n\tconst cache = useEmotionCache();\n\n\tconst cx = useCallback(\n\t\t( ...classNames: ( ClassNamesArg | SerializedStyles )[] ) => {\n\t\t\tif ( cache === null ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'The `useCx` hook should be only used within a valid Emotion Cache Context'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn innerCx(\n\t\t\t\t...classNames.map( ( arg ) => {\n\t\t\t\t\tif ( isSerializedStyles( arg ) ) {\n\t\t\t\t\t\tinsertStyles( cache, arg, false );\n\t\t\t\t\t\treturn `${ cache.key }-${ arg.name }`;\n\t\t\t\t\t}\n\t\t\t\t\treturn arg;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t[ cache ]\n\t);\n\n\treturn cx;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,wBAAwB,IAAIC,eAAe,QAAQ,gBAAgB;AAE5E,SAASC,YAAY,QAAQ,gBAAgB;AAC7C;;AAEA;AACA,SAASC,EAAE,IAAIC,OAAO,QAAQ,cAAc;;AAE5C;AACA;AACA;AACA,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,MAAMC,kBAAkB,GAAKC,CAAM,IAClC,OAAOA,CAAC,KAAK,WAAW,IACxBA,CAAC,KAAK,IAAI,IACV,CAAE,MAAM,EAAE,QAAQ,CAAE,CAACC,KAAK,CAAIC,CAAC,IAAM,OAAOF,CAAC,CAAEE,CAAC,CAAE,KAAK,WAAY,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAGA,CAAA,KAAM;EAC1B,MAAMC,KAAK,GAAGV,eAAe,CAAC,CAAC;EAE/B,MAAME,EAAE,GAAGE,WAAW,CACrB,CAAE,GAAGO,UAAkD,KAAM;IAC5D,IAAKD,KAAK,KAAK,IAAI,EAAG;MACrB,MAAM,IAAIE,KAAK,CACd,2EACD,CAAC;IACF;IAEA,OAAOT,OAAO,CACb,GAAGQ,UAAU,CAACE,GAAG,CAAIC,GAAG,IAAM;MAC7B,IAAKT,kBAAkB,CAAES,GAAI,CAAC,EAAG;QAChCb,YAAY,CAAES,KAAK,EAAEI,GAAG,EAAE,KAAM,CAAC;QACjC,OAAQ,GAAGJ,KAAK,CAACK,GAAK,IAAID,GAAG,CAACE,IAAM,EAAC;MACtC;MACA,OAAOF,GAAG;IACX,CAAE,CACH,CAAC;EACF,CAAC,EACD,CAAEJ,KAAK,CACR,CAAC;EAED,OAAOR,EAAE;AACV,CAAC"}

View File

@@ -0,0 +1,27 @@
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
import { useRef } from '@wordpress/element';
import { useIsomorphicLayoutEffect } from '@wordpress/compose';
/**
* Creates a reference for a prop. This is useful for preserving dependency
* memoization for hooks like useCallback.
*
* @see https://codesandbox.io/s/uselatestref-mlj3i?file=/src/App.tsx
*
* @param value The value to reference
* @return The prop reference.
*/
export function useLatestRef(value) {
const ref = useRef(value);
useIsomorphicLayoutEffect(() => {
ref.current = value;
});
return ref;
}
//# sourceMappingURL=use-latest-ref.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useRef","useIsomorphicLayoutEffect","useLatestRef","value","ref","current"],"sources":["@wordpress/components/src/utils/hooks/use-latest-ref.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useIsomorphicLayoutEffect } from '@wordpress/compose';\n\n/**\n * Creates a reference for a prop. This is useful for preserving dependency\n * memoization for hooks like useCallback.\n *\n * @see https://codesandbox.io/s/uselatestref-mlj3i?file=/src/App.tsx\n *\n * @param value The value to reference\n * @return The prop reference.\n */\nexport function useLatestRef< T >( value: T ): RefObject< T > {\n\tconst ref = useRef( value );\n\n\tuseIsomorphicLayoutEffect( () => {\n\t\tref.current = value;\n\t} );\n\n\treturn ref;\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,yBAAyB,QAAQ,oBAAoB;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAOC,KAAQ,EAAmB;EAC7D,MAAMC,GAAG,GAAGJ,MAAM,CAAEG,KAAM,CAAC;EAE3BF,yBAAyB,CAAE,MAAM;IAChCG,GAAG,CAACC,OAAO,GAAGF,KAAK;EACpB,CAAE,CAAC;EAEH,OAAOC,GAAG;AACX"}

View File

@@ -0,0 +1,30 @@
/**
* WordPress dependencies
*/
import { useRef, useEffect } from '@wordpress/element';
/**
* A `React.useEffect` that will not run on the first render.
* Source:
* https://github.com/reakit/reakit/blob/HEAD/packages/reakit-utils/src/useUpdateEffect.ts
*
* @param {import('react').EffectCallback} effect
* @param {import('react').DependencyList} deps
*/
function useUpdateEffect(effect, deps) {
const mounted = useRef(false);
useEffect(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
return undefined;
// Disable reasons:
// 1. This hook needs to pass a dep list that isn't an array literal
// 2. `effect` is missing from the array, and will need to be added carefully to avoid additional warnings
// see https://github.com/WordPress/gutenberg/pull/41166
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
}
export default useUpdateEffect;
//# sourceMappingURL=use-update-effect.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useRef","useEffect","useUpdateEffect","effect","deps","mounted","current","undefined"],"sources":["@wordpress/components/src/utils/hooks/use-update-effect.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\n\n/**\n * A `React.useEffect` that will not run on the first render.\n * Source:\n * https://github.com/reakit/reakit/blob/HEAD/packages/reakit-utils/src/useUpdateEffect.ts\n *\n * @param {import('react').EffectCallback} effect\n * @param {import('react').DependencyList} deps\n */\nfunction useUpdateEffect( effect, deps ) {\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tif ( mounted.current ) {\n\t\t\treturn effect();\n\t\t}\n\t\tmounted.current = true;\n\t\treturn undefined;\n\t\t// Disable reasons:\n\t\t// 1. This hook needs to pass a dep list that isn't an array literal\n\t\t// 2. `effect` is missing from the array, and will need to be added carefully to avoid additional warnings\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, deps );\n}\n\nexport default useUpdateEffect;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAEC,MAAM,EAAEC,IAAI,EAAG;EACxC,MAAMC,OAAO,GAAGL,MAAM,CAAE,KAAM,CAAC;EAC/BC,SAAS,CAAE,MAAM;IAChB,IAAKI,OAAO,CAACC,OAAO,EAAG;MACtB,OAAOH,MAAM,CAAC,CAAC;IAChB;IACAE,OAAO,CAACC,OAAO,GAAG,IAAI;IACtB,OAAOC,SAAS;IAChB;IACA;IACA;IACA;IACA;EACD,CAAC,EAAEH,IAAK,CAAC;AACV;AAEA,eAAeF,eAAe"}