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>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = createMiddleware;
|
|
var _isGenerator = _interopRequireDefault(require("./is-generator"));
|
|
var _runtime = _interopRequireDefault(require("./runtime"));
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* Creates a Redux middleware, given an object of controls where each key is an
|
|
* action type for which to act upon, the value a function which returns either
|
|
* a promise which is to resolve when evaluation of the action should continue,
|
|
* or a value. The value or resolved promise value is assigned on the return
|
|
* value of the yield assignment. If the control handler returns undefined, the
|
|
* execution is not continued.
|
|
*
|
|
* @param {Record<string, (value: import('redux').AnyAction) => Promise<boolean> | boolean>} controls Object of control handlers.
|
|
*
|
|
* @return {import('redux').Middleware} Co-routine runtime
|
|
*/
|
|
function createMiddleware(controls = {}) {
|
|
return store => {
|
|
const runtime = (0, _runtime.default)(controls, store.dispatch);
|
|
return next => action => {
|
|
if (!(0, _isGenerator.default)(action)) {
|
|
return next(action);
|
|
}
|
|
return runtime(action);
|
|
};
|
|
};
|
|
}
|
|
//# sourceMappingURL=index.js.map
|