Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3370747
D13860.id45582.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13860.id45582.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13860: [lib] Refactor messages queue in DMOpsQueueHandler
Attached
Detach File
Event Timeline
Log In to Comment