Setting Reactivity Keys on Runtime Atoms
How do I set reactivity keys on runtime atoms?
export const currentThreadIdAtom = Atom.kvs({
runtime: Atom.runtime(BrowserKeyValueStore.layerLocalStorage),
key: THREAD_ID_KEY,
schema: Schema.NullOr(ThreadId),
defaultValue: () => null,
});
// TODO: Add reactivity key
export const threadListAtom = ApiClient.runtime.atom((context) =>
Effect.gen(function* () {
const client = yield* ApiClient;
const currentThreadId = context.get(currentThreadIdAtom);
const threads = yield* client("ThreadList", undefined);
return threads.map((thread) => ({
...thread,
selected: thread.id === currentThreadId,
}));
})
);export const currentThreadIdAtom = Atom.kvs({
runtime: Atom.runtime(BrowserKeyValueStore.layerLocalStorage),
key: THREAD_ID_KEY,
schema: Schema.NullOr(ThreadId),
defaultValue: () => null,
});
// TODO: Add reactivity key
export const threadListAtom = ApiClient.runtime.atom((context) =>
Effect.gen(function* () {
const client = yield* ApiClient;
const currentThreadId = context.get(currentThreadIdAtom);
const threads = yield* client("ThreadList", undefined);
return threads.map((thread) => ({
...thread,
selected: thread.id === currentThreadId,
}));
})
);