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>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { INTERNAL_Snapshot } from '../vanilla';
|
|
/**
|
|
* proxyWithComputed
|
|
*
|
|
* This is to create a proxy with initial object and additional object,
|
|
* which specifies getters for computed values with dependency tracking.
|
|
* It also accepts optional setters for computed values.
|
|
*
|
|
* [Notes]
|
|
* This comes with a cost and overlaps with useSnapshot.
|
|
* Do not try to optimize too early. It can worsen the performance.
|
|
* Measurement and comparison will be very important.
|
|
*
|
|
* @example
|
|
* import { proxyWithComputed } from 'valtio/utils'
|
|
* const state = proxyWithComputed({
|
|
* count: 1,
|
|
* }, {
|
|
* doubled: snap => snap.count * 2, // getter only
|
|
* tripled: {
|
|
* get: snap => snap.count * 3,
|
|
* set: (state, newValue) => { state.count = newValue / 3 }
|
|
* }, // with optional setter
|
|
* })
|
|
*/
|
|
export declare function proxyWithComputed<T extends object, U extends object>(initialObject: T, computedFns: {
|
|
[K in keyof U]: ((snap: INTERNAL_Snapshot<T>) => U[K]) | {
|
|
get: (snap: INTERNAL_Snapshot<T>) => U[K];
|
|
set?: (state: T, newValue: U[K]) => void;
|
|
};
|
|
}): T & U;
|