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:
@ -1,5 +1,4 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { User } from '~/generated/graphql';
|
||||
|
||||
export type CurrentUser = Pick<
|
||||
@ -7,7 +6,7 @@ export type CurrentUser = Pick<
|
||||
'id' | 'email' | 'supportUserHash' | 'canImpersonate'
|
||||
>;
|
||||
|
||||
export const currentUserState = atom<CurrentUser | null>({
|
||||
export const currentUserState = createState<CurrentUser | null>({
|
||||
key: 'currentUserState',
|
||||
default: null,
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
||||
|
||||
export const currentWorkspaceMemberState = atom<Omit<
|
||||
export const currentWorkspaceMemberState = createState<Omit<
|
||||
WorkspaceMember,
|
||||
'createdAt' | 'updatedAt' | 'userId' | 'userEmail'
|
||||
> | null>({
|
||||
key: 'currentWorkspaceMemberState',
|
||||
default: null,
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { Workspace } from '~/generated/graphql';
|
||||
|
||||
export type CurrentWorkspace = Pick<
|
||||
@ -14,7 +13,7 @@ export type CurrentWorkspace = Pick<
|
||||
| 'activationStatus'
|
||||
>;
|
||||
|
||||
export const currentWorkspaceState = atom<CurrentWorkspace | null>({
|
||||
export const currentWorkspaceState = createState<CurrentWorkspace | null>({
|
||||
key: 'currentWorkspaceState',
|
||||
default: null,
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { atom } from 'recoil';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
export const isVerifyPendingState = atom<boolean>({
|
||||
export const isVerifyPendingState = createState<boolean>({
|
||||
key: 'isVerifyPendingState',
|
||||
default: false,
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { AuthTokenPair } from '~/generated/graphql';
|
||||
import { cookieStorageEffect } from '~/utils/recoil-effects';
|
||||
|
||||
export const tokenPairState = atom<AuthTokenPair | null>({
|
||||
export const tokenPairState = createState<AuthTokenPair | null>({
|
||||
key: 'tokenPairState',
|
||||
default: null,
|
||||
defaultValue: null,
|
||||
effects: [cookieStorageEffect('tokenPair')],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user