Open History to see the last commit
1import {
2 makeThreadTriageOutboxStore,
3 ThreadTriageOutboxStorageError,
4} from "@t3tools/client-runtime/platform";
5import * as Effect from "effect/Effect";
6
7const KEY = "t3code:thread-triage-outbox";
8
9/** In localStorage, so tabs share it and clearing the environment cache keeps unsynced changes. */
10export const browserThreadTriageOutboxStore = makeThreadTriageOutboxStore((next) =>
11 Effect.try({
12 try: () => {
13 const value = next(window.localStorage.getItem(KEY));
14 if (value !== null) window.localStorage.setItem(KEY, value);
15 },
16 catch: (cause) => new ThreadTriageOutboxStorageError({ cause }),
17 }),
18);