@@ -2,16 +2,30 @@ import { t } from 'i18next';
22import { useLocation } from 'react-router-dom' ;
33
44import { flagsHooks } from '@/app/common/hooks/flags-hooks' ;
5+ import { platformHooks } from '@/app/common/hooks/platform-hooks' ;
6+ import { projectHooks } from '@/app/common/hooks/project-hooks' ;
57import { useDefaultSidebarState } from '@/app/common/hooks/use-default-sidebar-state' ;
68import { useCandu } from '@/app/features/extensions/candu/use-candu' ;
79import { FlagId } from '@openops/shared' ;
810
911const OpenOpsTablesPage = ( ) => {
1012 useDefaultSidebarState ( 'minimized' ) ;
1113 const { isCanduEnabled, canduClientToken, canduUserId } = useCandu ( ) ;
12- const parentData = encodeURIComponent (
13- JSON . stringify ( { isCanduEnabled, userId : canduUserId , canduClientToken } ) ,
14- ) ;
14+ const { project } = projectHooks . useCurrentProject ( ) ;
15+ const { platform : organization } = platformHooks . useCurrentPlatform ( ) ;
16+
17+ // TODO: Remove type assertion and remove organization?.tablesWorkspaceId fallback once Phase 1 is complete
18+ const workspaceId =
19+ ( project as any ) ?. tablesWorkspaceId ?? organization ?. tablesWorkspaceId ;
20+
21+ const parentDataObj = {
22+ userId : canduUserId ?? undefined ,
23+ canduClientToken : canduClientToken ?? undefined ,
24+ ...( isCanduEnabled && { isCanduEnabled : true } ) ,
25+ ...( workspaceId !== undefined && { workspaceId } ) ,
26+ } ;
27+
28+ const parentData = encodeURIComponent ( JSON . stringify ( parentDataObj ) ) ;
1529
1630 const location = useLocation ( ) ;
1731 const params = new URLSearchParams ( location . search ) ;
0 commit comments