chore: generate
This commit is contained in:
@@ -19,7 +19,7 @@ export const { use: useKV, provider: KVProvider } = createSimpleContext({
|
||||
// Queue same-process writes so rapid updates persist in order.
|
||||
let write = Promise.resolve()
|
||||
|
||||
;Flock.withLock(lock, () => readJson<Record<string, unknown>>(file))
|
||||
Flock.withLock(lock, () => readJson<Record<string, unknown>>(file))
|
||||
.then((x) => {
|
||||
setStore(x)
|
||||
})
|
||||
@@ -55,9 +55,7 @@ export const { use: useKV, provider: KVProvider } = createSimpleContext({
|
||||
setStore(key, value)
|
||||
const snapshot = structuredClone(unwrap(store))
|
||||
write = write
|
||||
.then(() =>
|
||||
Flock.withLock(lock, () => writeJsonAtomic(file, snapshot)),
|
||||
)
|
||||
.then(() => Flock.withLock(lock, () => writeJsonAtomic(file, snapshot)))
|
||||
.catch((error) => {
|
||||
console.error("Failed to write KV state", { error })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user