Page MenuHomePhabricator

D13000.id43182.diff
No OneTemporary

D13000.id43182.diff

diff --git a/lib/shared/community-utils.js b/lib/shared/community-utils.js
--- a/lib/shared/community-utils.js
+++ b/lib/shared/community-utils.js
@@ -32,6 +32,7 @@
import type { ThreadSubscription } from '../types/subscription-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import { threadTypes } from '../types/thread-types-enum.js';
+import type { ThreadJoinPayload } from '../types/thread-types.js';
import { useCurrentUserFID } from '../utils/farcaster-utils.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useDispatch, useSelector } from '../utils/redux-utils.js';
@@ -324,9 +325,14 @@
}
}, [isAuthenticated, ongoingJoinData, setStep, step]);
+ const threadJoinPromiseRef = React.useRef<?Promise<ThreadJoinPayload>>(null);
React.useEffect(() => {
void (async () => {
- if (!ongoingJoinData || step !== 'join_community') {
+ if (
+ !ongoingJoinData ||
+ step !== 'join_community' ||
+ threadJoinPromiseRef.current
+ ) {
return;
}
const communityThreadID = ongoingJoinData.communityID;
@@ -344,6 +350,7 @@
inviteLinkSecret: inviteSecret,
defaultSubscription,
});
+ threadJoinPromiseRef.current = joinThreadPromise;
void dispatchActionPromise(joinThreadActionTypes, joinThreadPromise);
try {
@@ -355,6 +362,8 @@
);
ongoingJoinData.reject();
setOngoingJoinData(null);
+ } finally {
+ threadJoinPromiseRef.current = null;
}
})();
}, [

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 6:29 PM (17 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585754
Default Alt Text
D13000.id43182.diff (1 KB)

Event Timeline