fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lighthouse = void 0;
const lighthouse = require("lighthouse/core/index.cjs");
class Lighthouse {
page;
port;
constructor({ page, port }) {
this.page = page;
this.port = port;
}
/**
* Returns the Lighthouse report for the current URL.
*
* Runs several Lighthouse audits in a separate browser window and returns
* the summary.
*/
async getReport() {
// From https://github.com/GoogleChrome/lighthouse/blob/d149e9c1b628d5881ca9ca451278d99ff1b31d9a/core/config/default-config.js#L433-L503
const audits = {
'largest-contentful-paint': 'LCP',
'total-blocking-time': 'TBT',
interactive: 'TTI',
'cumulative-layout-shift': 'CLS',
'experimental-interaction-to-next-paint': 'INP',
};
const report = await lighthouse(this.page.url(), { port: this.port }, {
extends: 'lighthouse:default',
settings: {
// "provided" means no throttling.
// TODO: Make configurable.
throttlingMethod: 'provided',
// Default is "mobile".
// See https://github.com/GoogleChrome/lighthouse/blob/main/docs/emulation.md
// TODO: Make configurable.
formFactor: 'desktop',
screenEmulation: {
disabled: true,
},
// Speeds up the report.
disableFullPageScreenshot: true,
// Only run certain audits to speed things up.
onlyAudits: Object.keys(audits),
},
});
const result = {};
if (!report) {
return result;
}
const { lhr } = report;
for (const [audit, acronym] of Object.entries(audits)) {
result[acronym] = lhr.audits[audit]?.numericValue || 0;
}
return result;
}
}
exports.Lighthouse = Lighthouse;
//# sourceMappingURL=index.js.map

View File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