Introduce ComponentState (#4386)

* Proof of concept ComponentState

* Migrate to createState and createFamilyState

* Refactor

* Fix

* Fix tests

* Fix lint

* Fix tests

* Re-enable coverage
This commit is contained in:
Charles Bochet
2024-03-09 11:31:00 +01:00
committed by GitHub
parent 17511be0cf
commit 86c0f311f5
451 changed files with 1718 additions and 2557 deletions

View File

@ -1,7 +1,7 @@
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
import { ComponentStateKey } from '@/ui/utilities/state/component-state/types/ComponentStateKey';
type DialogManagerScopeInternalContextProps = StateScopeMapKey;
type DialogManagerScopeInternalContextProps = ComponentStateKey;
export const DialogManagerScopeInternalContext =
createScopeInternalContext<DialogManagerScopeInternalContextProps>();

View File

@ -1,4 +1,4 @@
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
import { DialogOptions } from '../types/DialogOptions';
@ -7,7 +7,7 @@ type DialogState = {
queue: DialogOptions[];
};
export const dialogInternalScopedState = createStateScopeMap<DialogState>({
export const dialogInternalScopedState = createComponentState<DialogState>({
key: 'dialog/internal-state',
defaultValue: {
maxQueue: 2,

View File

@ -1,7 +1,7 @@
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
import { ComponentStateKey } from '@/ui/utilities/state/component-state/types/ComponentStateKey';
type SnackBarManagerScopeInternalContextProps = StateScopeMapKey;
type SnackBarManagerScopeInternalContextProps = ComponentStateKey;
export const SnackBarManagerScopeInternalContext =
createScopeInternalContext<SnackBarManagerScopeInternalContextProps>();

View File

@ -1,4 +1,4 @@
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
import { SnackBarProps } from '../components/SnackBar';
@ -11,7 +11,7 @@ export type SnackBarState = {
queue: SnackBarOptions[];
};
export const snackBarInternalScopedState = createStateScopeMap<SnackBarState>({
export const snackBarInternalScopedState = createComponentState<SnackBarState>({
key: 'snackBarState',
defaultValue: {
maxQueue: 3,