You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"The returned iterable's values are each shared between all its parallel consumers so that each receives all the values that will yield after the start of its consumption"
171
+
"The returned iterable's values are each shared between all its parallel consumers so that each will receives all values that will yield from the time it started consuming"
Copy file name to clipboardExpand all lines: src/useAsyncIterState/IterableChannel.ts
+6-3
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,12 @@ class IterableChannel<T> {
10
10
11
11
put(value: T): void{
12
12
if(!this.#isClosed){
13
-
this.#currentValue =value;
14
-
this.#nextIteration.resolve({done: false, value });
15
-
this.#nextIteration =promiseWithResolvers();
13
+
(async()=>{
14
+
this.#currentValue =value;
15
+
awaitundefined;// Deferring to the next microtick so that an attempt to pull the a value before making multiple rapid synchronous calls to `put()` will make that pull ultimately yield only the last value that was put - instead of the first one as were if this otherwise wasn't deferred.
0 commit comments