File size: 1,537 Bytes
f0743f4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | import { atom } from 'recoil';
import { logger } from '~/utils';
import type { Artifact } from '~/common';
export const artifactsState = atom<Record<string, Artifact | undefined> | null>({
key: 'artifactsState',
default: null,
effects: [
({ onSet, node }) => {
onSet(async (newValue) => {
logger.log('artifacts', 'Recoil Effect: Setting artifactsState', {
key: node.key,
newValue,
});
});
},
] as const,
});
export const currentArtifactId = atom<string | null>({
key: 'currentArtifactId',
default: null,
effects: [
({ onSet, node }) => {
onSet(async (newValue) => {
logger.log('artifacts', 'Recoil Effect: Setting currentArtifactId', {
key: node.key,
newValue,
});
});
},
] as const,
});
export const artifactsVisibility = atom<boolean>({
key: 'artifactsVisibility',
default: true,
effects: [
({ onSet, node }) => {
onSet(async (newValue) => {
logger.log('artifacts', 'Recoil Effect: Setting artifactsVisibility', {
key: node.key,
newValue,
});
});
},
] as const,
});
export const visibleArtifacts = atom<Record<string, Artifact | undefined> | null>({
key: 'visibleArtifacts',
default: null,
effects: [
({ onSet, node }) => {
onSet(async (newValue) => {
logger.log('artifacts', 'Recoil Effect: Setting `visibleArtifacts`', {
key: node.key,
newValue,
});
});
},
] as const,
});
|