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>
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
/**
|
|
* Given a path, returns a normalized path where equal query parameter values
|
|
* will be treated as identical, regardless of order they appear in the original
|
|
* text.
|
|
*
|
|
* @param {string} path Original path.
|
|
*
|
|
* @return {string} Normalized path.
|
|
*/
|
|
export function normalizePath(path) {
|
|
const splitted = path.split('?');
|
|
const query = splitted[1];
|
|
const base = splitted[0];
|
|
if (!query) {
|
|
return base;
|
|
}
|
|
|
|
// 'b=1%2C2&c=2&a=5'
|
|
return base + '?' + query
|
|
// [ 'b=1%2C2', 'c=2', 'a=5' ]
|
|
.split('&')
|
|
// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]
|
|
.map(entry => entry.split('='))
|
|
// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]
|
|
.map(pair => pair.map(decodeURIComponent))
|
|
// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]
|
|
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]
|
|
.map(pair => pair.map(encodeURIComponent))
|
|
// [ 'a=5', 'b=1%2C2', 'c=2' ]
|
|
.map(pair => pair.join('='))
|
|
// 'a=5&b=1%2C2&c=2'
|
|
.join('&');
|
|
}
|
|
//# sourceMappingURL=normalize-path.js.map
|