@@ -40,7 +40,10 @@ import { CommunityApplyErrorScreen } from "@/features/communities/ui/CommunityAp
4040import { CommunityChangeOverlay } from "@/features/communities/ui/CommunityChangeOverlay" ;
4141import { createBuzzQueryClient } from "@/shared/api/queryClient" ;
4242import { isSharedIdentity as isSharedIdentityCmd } from "@/shared/api/tauri" ;
43- import { listenForDeepLinks } from "@/shared/deep-link" ;
43+ import {
44+ type AddCommunityDeepLinkPayload ,
45+ listenForDeepLinks ,
46+ } from "@/shared/deep-link" ;
4447import { cn } from "@/shared/lib/cn" ;
4548import { BuzzMark } from "@/shared/ui/buzz-logo/BuzzMark" ;
4649import { FlappingBee } from "@/shared/ui/buzz-logo/FlappingBee" ;
@@ -421,6 +424,18 @@ function MachineBootstrap({ sharedIdentity }: { sharedIdentity: boolean }) {
421424 [ machine . complete ] ,
422425 ) ;
423426
427+ const openAddCommunity = useCallback (
428+ ( payload : AddCommunityDeepLinkPayload & { requestId : string } ) =>
429+ activeCommunity
430+ ? requestAddCommunityPrefill ( payload )
431+ : communityOnboarding . start ( {
432+ source : "add-community" ,
433+ relayUrl : payload . relayUrl ,
434+ communityName : payload . name ,
435+ } ) ,
436+ [ activeCommunity , communityOnboarding . start ] ,
437+ ) ;
438+
424439 // Deep links are captured here — above the machine-onboarding gate — not in
425440 // CommunityApp. The Rust side queues them; draining into the persisted
426441 // community-onboarding transaction immediately means an invite opened on a
@@ -429,13 +444,13 @@ function MachineBootstrap({ sharedIdentity }: { sharedIdentity: boolean }) {
429444 useEffect ( ( ) => {
430445 const unlisten = listenForDeepLinks ( {
431446 startCommunityOnboarding : communityOnboarding . start ,
432- openAddCommunity : requestAddCommunityPrefill ,
447+ openAddCommunity,
433448 onAddCommunityAvailable : onAddCommunityPrefillAvailable ,
434449 } ) ;
435450 return ( ) => {
436451 void unlisten . then ( ( fn ) => fn ( ) ) ;
437452 } ;
438- } , [ communityOnboarding . start ] ) ;
453+ } , [ communityOnboarding . start , openAddCommunity ] ) ;
439454
440455 if ( machine . stage === "reset-failed" ) return < ResetFailedScreen /> ;
441456 if ( machine . stage === "keyring-locked" ) return < KeyringLockedScreen /> ;
0 commit comments