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>
28 lines
1012 B
JavaScript
28 lines
1012 B
JavaScript
'use strict';
|
|
var DESCRIPTORS = require('../internals/descriptors');
|
|
var isArray = require('../internals/is-array');
|
|
|
|
var $TypeError = TypeError;
|
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
|
|
// Safari < 13 does not throw an error in this case
|
|
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
|
|
// makes no sense without proper strict mode support
|
|
if (this !== undefined) return true;
|
|
try {
|
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
Object.defineProperty([], 'length', { writable: false }).length = 1;
|
|
} catch (error) {
|
|
return error instanceof TypeError;
|
|
}
|
|
}();
|
|
|
|
module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
|
|
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
|
|
throw new $TypeError('Cannot set read only .length');
|
|
} return O.length = length;
|
|
} : function (O, length) {
|
|
return O.length = length;
|
|
};
|