@@ -84,6 +84,17 @@ export function CustomBlockDetail({ blockId, workspaceId, onBack }: CustomBlockD
8484
8585 // Source picker (create only). Editing a block never re-points its source.
8686 const { data : workspaces = [ ] } = useWorkspacesQuery ( isCreate )
87+ // Custom blocks are org-scoped and the settings list only shows the current org's
88+ // blocks, so a block published to another org's workspace would silently never
89+ // appear here. Restrict the picker to workspaces in the current workspace's org.
90+ const currentOrgId = useMemo (
91+ ( ) => workspaces . find ( ( w ) => w . id === workspaceId ) ?. organizationId ?? null ,
92+ [ workspaces , workspaceId ]
93+ )
94+ const orgWorkspaces = useMemo (
95+ ( ) => ( currentOrgId ? workspaces . filter ( ( w ) => w . organizationId === currentOrgId ) : [ ] ) ,
96+ [ workspaces , currentOrgId ]
97+ )
8798 const [ selectedWorkspaceId , setSelectedWorkspaceId ] = useState ( workspaceId )
8899 const [ selectedWorkflowId , setSelectedWorkflowId ] = useState ( '' )
89100 const { data : workflows = [ ] } = useWorkflows ( isCreate ? selectedWorkspaceId : undefined )
@@ -389,7 +400,7 @@ export function CustomBlockDetail({ blockId, workspaceId, onBack }: CustomBlockD
389400 dropdownWidth = 'trigger'
390401 searchable
391402 placeholder = 'Select a workspace'
392- options = { workspaces . map ( ( w ) => ( { value : w . id , label : w . name } ) ) }
403+ options = { orgWorkspaces . map ( ( w ) => ( { value : w . id , label : w . name } ) ) }
393404 value = { selectedWorkspaceId }
394405 onChange = { ( v : string ) => {
395406 setSelectedWorkspaceId ( v )
0 commit comments