@@ -25,6 +25,7 @@ import {
2525 BoostHubSubscriptionDeleteEvent ,
2626 boostHubSubscriptionDeleteEventEmitter ,
2727 boostHubSubscriptionUpdateEventEmitter ,
28+ boostHubCreateCloudSpaceEventEmitter ,
2829} from '../lib/events'
2930import { useRouteParams } from '../lib/routeParams'
3031import { useStorageRouter } from '../lib/storageRouter'
@@ -173,17 +174,6 @@ const App = () => {
173174 } )
174175 } )
175176
176- useEffect ( ( ) => {
177- const createCloudSpaceHandler = ( ) => {
178- push ( '/app/boosthub/teams' )
179- }
180- addIpcListener ( 'create-cloud-space' , createCloudSpaceHandler )
181-
182- return ( ) => {
183- removeIpcListener ( 'create-cloud-space' , createCloudSpaceHandler )
184- }
185- } , [ push ] )
186-
187177 useEffect ( ( ) => {
188178 const boostHubTeamCreateEventHandler = ( event : BoostHubTeamCreateEvent ) => {
189179 const createdTeam = event . detail . team
@@ -305,6 +295,10 @@ const App = () => {
305295 push ( `/app/storages` )
306296 }
307297
298+ const boostHubCreateCloudSpaceEventHandler = ( ) => {
299+ push ( '/app/boosthub/teams' )
300+ }
301+
308302 boostHubSubscriptionDeleteEventEmitter . listen (
309303 boostHubSubscriptionDeleteEventHandler
310304 )
@@ -318,6 +312,9 @@ const App = () => {
318312 boostHubCreateLocalSpaceEventEmitter . listen (
319313 boostHubCreateLocalSpaceEventHandler
320314 )
315+ boostHubCreateCloudSpaceEventEmitter . listen (
316+ boostHubCreateCloudSpaceEventHandler
317+ )
321318 return ( ) => {
322319 boostHubSubscriptionDeleteEventEmitter . unlisten (
323320 boostHubSubscriptionDeleteEventHandler
@@ -334,6 +331,9 @@ const App = () => {
334331 boostHubCreateLocalSpaceEventEmitter . unlisten (
335332 boostHubCreateLocalSpaceEventHandler
336333 )
334+ boostHubCreateCloudSpaceEventEmitter . unlisten (
335+ boostHubCreateCloudSpaceEventHandler
336+ )
337337 }
338338 } , [ push , setPreferences , setGeneralStatus ] )
339339 const { boostHubTeams } = generalStatus
@@ -356,13 +356,25 @@ const App = () => {
356356 } ,
357357 [ storageMap , boostHubTeams , navigateToStorage , push ]
358358 )
359+
359360 useEffect ( ( ) => {
360361 addIpcListener ( 'switch-workspace' , switchWorkspaceHandler )
361362 return ( ) => {
362363 removeIpcListener ( 'switch-workspace' , switchWorkspaceHandler )
363364 }
364365 } , [ switchWorkspaceHandler ] )
365366
367+ useEffect ( ( ) => {
368+ const createCloudSpaceHandler = ( ) => {
369+ boostHubCreateCloudSpaceEventEmitter . dispatch ( )
370+ }
371+ addIpcListener ( 'create-cloud-space' , createCloudSpaceHandler )
372+
373+ return ( ) => {
374+ removeIpcListener ( 'create-cloud-space' , createCloudSpaceHandler )
375+ }
376+ } , [ push ] )
377+
366378 useBoostNoteProtocol ( )
367379
368380 const { showingCloudIntroModal } = useCloudIntroModal ( )
0 commit comments