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,66 @@
/**
* Based on https://github.com/facebook/jest/pull/11320.
*
* We might be able to remove this file once the Jest PR is merged, and a
* version of Jest that includes the GithubActionsReporter is released.
*/
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const newLine = /\n/g;
const encodedNewLine = '%0A';
const lineAndColumnInStackTrace = /^.*?:([0-9]+):([0-9]+).*$/;
class GithubActionsReporter {
async onRunComplete( _contexts, _aggregatedResults ) {
if ( ! process.env.GITHUB_ACTIONS ) {
return;
}
if ( ! _aggregatedResults ) {
return;
}
const messages = getMessages( _aggregatedResults.testResults );
for ( const message of messages ) {
// eslint-disable-next-line no-console
console.log( message );
}
}
}
function getMessages( results ) {
if ( ! results ) {
return [];
}
return results.reduce(
flatMap( ( { testFilePath, testResults } ) =>
testResults
.filter( ( r ) => r.status === 'failed' )
.reduce(
flatMap( ( r ) => r.failureMessages ),
[]
)
.map( ( m ) => m.replace( newLine, encodedNewLine ) )
.map( ( m ) => lineAndColumnInStackTrace.exec( m ) )
.filter( ( m ) => m !== null )
.map(
( [ message, line, col ] ) =>
`::error file=${ testFilePath },line=${ line },col=${ col }::${ message }`
)
),
[]
);
}
function flatMap( fn ) {
return ( out, entry ) => out.concat( ...fn( entry ) );
}
module.exports = GithubActionsReporter;