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,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useObservableValue;
var _element = require("@wordpress/element");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* React hook that lets you observe an entry in an `ObservableMap`. The hook returns the
* current value corresponding to the key, or `undefined` when there is no value stored.
* It also observes changes to the value and triggers an update of the calling component
* in case the value changes.
*
* @template K The type of the keys in the map.
* @template V The type of the values in the map.
* @param map The `ObservableMap` to observe.
* @param name The map key to observe.
* @return The value corresponding to the map key requested.
*/
function useObservableValue(map, name) {
const [subscribe, getValue] = (0, _element.useMemo)(() => [listener => map.subscribe(name, listener), () => map.get(name)], [map, name]);
return (0, _element.useSyncExternalStore)(subscribe, getValue, getValue);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_element","require","useObservableValue","map","name","subscribe","getValue","useMemo","listener","get","useSyncExternalStore"],"sources":["@wordpress/compose/src/hooks/use-observable-value/index.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useSyncExternalStore } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ObservableMap } from '../../utils/observable-map';\n\n/**\n * React hook that lets you observe an entry in an `ObservableMap`. The hook returns the\n * current value corresponding to the key, or `undefined` when there is no value stored.\n * It also observes changes to the value and triggers an update of the calling component\n * in case the value changes.\n *\n * @template K The type of the keys in the map.\n * @template V The type of the values in the map.\n * @param map The `ObservableMap` to observe.\n * @param name The map key to observe.\n * @return The value corresponding to the map key requested.\n */\nexport default function useObservableValue< K, V >(\n\tmap: ObservableMap< K, V >,\n\tname: K\n): V | undefined {\n\tconst [ subscribe, getValue ] = useMemo(\n\t\t() => [\n\t\t\t( listener: () => void ) => map.subscribe( name, listener ),\n\t\t\t() => map.get( name ),\n\t\t],\n\t\t[ map, name ]\n\t);\n\treturn useSyncExternalStore( subscribe, getValue, getValue );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,kBAAkBA,CACzCC,GAA0B,EAC1BC,IAAO,EACS;EAChB,MAAM,CAAEC,SAAS,EAAEC,QAAQ,CAAE,GAAG,IAAAC,gBAAO,EACtC,MAAM,CACHC,QAAoB,IAAML,GAAG,CAACE,SAAS,CAAED,IAAI,EAAEI,QAAS,CAAC,EAC3D,MAAML,GAAG,CAACM,GAAG,CAAEL,IAAK,CAAC,CACrB,EACD,CAAED,GAAG,EAAEC,IAAI,CACZ,CAAC;EACD,OAAO,IAAAM,6BAAoB,EAAEL,SAAS,EAAEC,QAAQ,EAAEA,QAAS,CAAC;AAC7D","ignoreList":[]}