Page MenuHomePhabricator

D13860.id45582.diff
No OneTemporary

D13860.id45582.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
@@ -122,20 +122,25 @@
}, [dispatch, enqueue, queuedThreadOperations, threadInfos]);
const messageInfos = useSelector(messageInfoSelector);
- const prevMessageInfosRef = React.useRef({});
const queuedMessageOperations = useSelector(
state => state.queuedDMOperations.messageQueue,
);
- React.useEffect(() => {
- const prevMessageInfos = prevMessageInfosRef.current;
- prevMessageInfosRef.current = messageInfos;
+ const runningMessageOperations = React.useRef<Set<string>>(new Set());
+ React.useEffect(() => {
for (const messageID in queuedMessageOperations) {
- if (!messageInfos[messageID] || prevMessageInfos[messageID]) {
+ if (!messageInfos[messageID]) {
+ continue;
+ }
+
+ if (runningMessageOperations.current.has(messageID)) {
continue;
}
+
+ runningMessageOperations.current.add(messageID);
+
enqueue([
...queuedMessageOperations[messageID].map(item => ({
type: 'operation',
@@ -150,6 +155,11 @@
},
},
},
+ {
+ type: 'function',
+ itemFunction: () =>
+ runningMessageOperations.current.delete(messageID),
+ },
]);
}
}, [dispatch, enqueue, messageInfos, queuedMessageOperations]);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 3:51 AM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2587653
Default Alt Text
D13860.id45582.diff (1 KB)

Event Timeline