Page MenuHomePhabricator

D13814.id45462.diff
No OneTemporary

D13814.id45462.diff

diff --git a/lib/hooks/actions-queue.js b/lib/hooks/actions-queue.js
--- a/lib/hooks/actions-queue.js
+++ b/lib/hooks/actions-queue.js
@@ -8,6 +8,7 @@
function useActionsQueue<T>(
performAction: (item: T) => mixed | Promise<mixed>,
+ canProcess: boolean = true,
): MessageQueueHook<T> {
const [queue, setQueue] = React.useState<$ReadOnlyArray<T>>([]);
const isProcessing = React.useRef(false);
@@ -32,11 +33,11 @@
);
React.useEffect(() => {
- if (isProcessing.current || queue.length === 0) {
+ if (isProcessing.current || queue.length === 0 || !canProcess) {
return;
}
void process(queue[0]);
- }, [process, queue]);
+ }, [process, queue, canProcess]);
return { enqueue };
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 8:50 PM (16 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2572397
Default Alt Text
D13814.id45462.diff (730 B)

Event Timeline