Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3163146
D13859.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
D13859.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
@@ -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
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 1:41 PM (4 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436335
Default Alt Text
D13859.diff (1 KB)
Attached To
Mode
D13859: [lib] Refactor entries queue in DMOpsQueueHandler
Attached
Detach File
Event Timeline
Log In to Comment