Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33129400
D12718.1768497708.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12718.1768497708.diff
View Options
diff --git a/lib/components/farcaster-data-handler.react.js b/lib/components/farcaster-data-handler.react.js
--- a/lib/components/farcaster-data-handler.react.js
+++ b/lib/components/farcaster-data-handler.react.js
@@ -19,7 +19,13 @@
import { useSelector, useDispatch } from '../utils/redux-utils.js';
import { usingCommServicesAccessToken } from '../utils/services-utils.js';
-function FarcasterDataHandler(): React.Node {
+type Props = {
+ +children?: React.Node,
+};
+
+function FarcasterDataHandler(props: Props): React.Node {
+ const { children } = props;
+
const isActive = useSelector(state => state.lifecycleState !== 'background');
const currentUserID = useSelector(state => state.currentUserInfo?.id);
@@ -139,6 +145,8 @@
const prevCanQueryHandleCurrentUserFIDRef = React.useRef<?boolean>();
const canQueryHandleCurrentUserFID = isActive && loggedIn;
+ const [fidLoaded, setFIDLoaded] = React.useState(false);
+
const handleCurrentUserFID = React.useCallback(async () => {
if (
canQueryHandleCurrentUserFID ===
@@ -181,6 +189,8 @@
},
});
}
+
+ setFIDLoaded(true);
}, [
canQueryHandleCurrentUserFID,
findUserIdentities,
@@ -201,7 +211,23 @@
void handleCurrentUserFID();
}, [handleCurrentUserFID, handleFarcasterMutuals, handleUserStoreFIDs]);
- return null;
+ React.useEffect(() => {
+ if (loggedIn) {
+ return;
+ }
+
+ setFIDLoaded(false);
+ }, [loggedIn]);
+
+ const farcasterDataHandler = React.useMemo(() => {
+ if (!fidLoaded) {
+ return null;
+ }
+
+ return children;
+ }, [children, fidLoaded]);
+
+ return farcasterDataHandler;
}
export { FarcasterDataHandler };
diff --git a/native/root.react.js b/native/root.react.js
--- a/native/root.react.js
+++ b/native/root.react.js
@@ -308,7 +308,11 @@
</DeepLinksContextProvider>
</ChatContextProvider>
<NavigationHandler />
- <ConnectFarcasterAlertHandler />
+ <PersistedStateGate>
+ <FarcasterDataHandler>
+ <ConnectFarcasterAlertHandler />
+ </FarcasterDataHandler>
+ </PersistedStateGate>
</BottomSheetModalProvider>
</NavigationContainer>
);
@@ -367,7 +371,6 @@
<BackgroundIdentityLoginHandler />
<PrekeysHandler />
<ReportHandler />
- <FarcasterDataHandler />
<AutoJoinCommunityHandler />
</PersistedStateGate>
{navigation}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 5:21 PM (4 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5938546
Default Alt Text
D12718.1768497708.diff (2 KB)
Attached To
Mode
D12718: [native] fix farcaster prompt being displayed to users with fid on login
Attached
Detach File
Event Timeline
Log In to Comment