effect-atom-svelte 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Hooks.svelte.js +9 -3
- package/package.json +1 -1
package/dist/Hooks.svelte.js
CHANGED
|
@@ -334,11 +334,17 @@ export function useAtomSet(input, options) {
|
|
|
334
334
|
throw new TypeError(`useAtomSet's ${mode} mode cannot wait for Atom.Reset; reset with a value mode setter`);
|
|
335
335
|
}
|
|
336
336
|
const atom = getAtom();
|
|
337
|
-
// An already aborted signal
|
|
338
|
-
|
|
337
|
+
// An already aborted signal settles as interrupted without writing, as fetch does (JND-25). It
|
|
338
|
+
// skips the wait too: Effect checks the signal only after a first run, which would return a
|
|
339
|
+
// result the atom already holds from an earlier call.
|
|
340
|
+
let exit;
|
|
341
|
+
if (writeOptions?.signal?.aborted) {
|
|
342
|
+
exit = Exit.interrupt();
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
339
345
|
registry.set(atom, value);
|
|
346
|
+
exit = await awaitResult(registry, atom, { suspendOnWaiting: true }, writeOptions?.signal);
|
|
340
347
|
}
|
|
341
|
-
const exit = await awaitResult(registry, atom, { suspendOnWaiting: true }, writeOptions?.signal);
|
|
342
348
|
return mode === "promiseExit" ? exit : valueOrThrow(exit);
|
|
343
349
|
};
|
|
344
350
|
}
|