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>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
/**
|
|
* CommanderError class
|
|
*/
|
|
class CommanderError extends Error {
|
|
/**
|
|
* Constructs the CommanderError class
|
|
* @param {number} exitCode suggested exit code which could be used with process.exit
|
|
* @param {string} code an id string representing the error
|
|
* @param {string} message human-readable description of the error
|
|
*/
|
|
constructor(exitCode, code, message) {
|
|
super(message);
|
|
// properly capture stack trace in Node.js
|
|
Error.captureStackTrace(this, this.constructor);
|
|
this.name = this.constructor.name;
|
|
this.code = code;
|
|
this.exitCode = exitCode;
|
|
this.nestedError = undefined;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* InvalidArgumentError class
|
|
*/
|
|
class InvalidArgumentError extends CommanderError {
|
|
/**
|
|
* Constructs the InvalidArgumentError class
|
|
* @param {string} [message] explanation of why argument is invalid
|
|
*/
|
|
constructor(message) {
|
|
super(1, 'commander.invalidArgument', message);
|
|
// properly capture stack trace in Node.js
|
|
Error.captureStackTrace(this, this.constructor);
|
|
this.name = this.constructor.name;
|
|
}
|
|
}
|
|
|
|
exports.CommanderError = CommanderError;
|
|
exports.InvalidArgumentError = InvalidArgumentError;
|