Files
twenty_crm/front/src/modules/ui/recoil-scope/utils/getSnapshotScopedState.ts
Lucas Bordeau 7ecb098c55 Feat/editable fields update (#743)
* Removed console log

* Used current scope as default parent scope for fields

* Finished editable fields on people show page

* Added stories

* Console log

* Lint
2023-07-19 00:43:16 +00:00

14 lines
307 B
TypeScript

import { RecoilState, Snapshot } from 'recoil';
export function getSnapshotScopedState<T>({
snapshot,
state,
contextScopeId,
}: {
snapshot: Snapshot;
state: (scopeId: string) => RecoilState<T>;
contextScopeId: string;
}) {
return snapshot.getLoadable(state(contextScopeId)).valueOrThrow();
}