Page MenuHomePhabricator

D13859.id45581.diff
No OneTemporary

D13859.id45581.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
Fri, Nov 22, 2:54 PM (17 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2561921
Default Alt Text
D13859.id45581.diff (1 KB)

Event Timeline