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>
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
/**
|
|
* Helper to decycle json objects
|
|
*/
|
|
export function memoBuilder() {
|
|
var hasWeakSet = typeof WeakSet === 'function';
|
|
var inner = hasWeakSet ? new WeakSet() : [];
|
|
function memoize(obj) {
|
|
if (hasWeakSet) {
|
|
if (inner.has(obj)) {
|
|
return true;
|
|
}
|
|
inner.add(obj);
|
|
return false;
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
for (var i = 0; i < inner.length; i++) {
|
|
var value = inner[i];
|
|
if (value === obj) {
|
|
return true;
|
|
}
|
|
}
|
|
inner.push(obj);
|
|
return false;
|
|
}
|
|
function unmemoize(obj) {
|
|
if (hasWeakSet) {
|
|
inner.delete(obj);
|
|
}
|
|
else {
|
|
for (var i = 0; i < inner.length; i++) {
|
|
if (inner[i] === obj) {
|
|
inner.splice(i, 1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [memoize, unmemoize];
|
|
}
|
|
//# sourceMappingURL=memo.js.map
|