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>
31 lines
937 B
JavaScript
31 lines
937 B
JavaScript
import { createContext, useRef, useCallback, createElement } from 'react';
|
|
|
|
var defaultPrefix = "id";
|
|
function generateRandomString(prefix) {
|
|
if (prefix === void 0) {
|
|
prefix = defaultPrefix;
|
|
}
|
|
|
|
return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6);
|
|
}
|
|
|
|
var unstable_IdContext = /*#__PURE__*/createContext(generateRandomString);
|
|
function unstable_IdProvider(_ref) {
|
|
var children = _ref.children,
|
|
_ref$prefix = _ref.prefix,
|
|
prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
|
|
var count = useRef(0);
|
|
var generateId = useCallback(function (localPrefix) {
|
|
if (localPrefix === void 0) {
|
|
localPrefix = prefix;
|
|
}
|
|
|
|
return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current;
|
|
}, [prefix]);
|
|
return /*#__PURE__*/createElement(unstable_IdContext.Provider, {
|
|
value: generateId
|
|
}, children);
|
|
}
|
|
|
|
export { unstable_IdContext, unstable_IdProvider };
|