Page MenuHomePhabricator

D13859.diff
No OneTemporary

D13859.diff

diff --git a/lib/shared/dm-ops/dm-ops-queue-handler.react.js b/lib/shared/dm-ops/dm-ops-queue-handler.react.js
--- a/lib/shared/dm-ops/dm-ops-queue-handler.react.js
+++ b/lib/shared/dm-ops/dm-ops-queue-handler.react.js
@@ -155,20 +155,25 @@
}, [dispatch, enqueue, messageInfos, queuedMessageOperations]);
const entryInfos = useSelector(entryInfoSelector);
- const prevEntryInfosRef = React.useRef({});
const queuedEntryOperations = useSelector(
state => state.queuedDMOperations.entryQueue,
);
- React.useEffect(() => {
- const prevEntryInfos = prevEntryInfosRef.current;
- prevEntryInfosRef.current = entryInfos;
+ const runningEntryOperations = React.useRef<Set<string>>(new Set());
+ React.useEffect(() => {
for (const entryID in queuedEntryOperations) {
- if (!entryInfos[entryID] || prevEntryInfos[entryID]) {
+ if (!entryInfos[entryID]) {
+ continue;
+ }
+
+ if (runningEntryOperations.current.has(entryID)) {
continue;
}
+
+ runningEntryOperations.current.add(entryID);
+
enqueue([
...queuedEntryOperations[entryID].map(item => ({
type: 'operation',
@@ -183,6 +188,10 @@
},
},
},
+ {
+ type: 'function',
+ itemFunction: () => runningEntryOperations.current.delete(entryID),
+ },
]);
}
}, [dispatch, enqueue, entryInfos, queuedEntryOperations]);

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 7, 9:31 PM (12 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436335
Default Alt Text
D13859.diff (1 KB)

Event Timeline