File tree Expand file tree Collapse file tree
apps/sim/ee/custom-blocks/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export function CustomBlocks() {
2929 const canAdmin = canMutateWorkspaceSettingsSection ( 'custom-blocks' , workspacePermissions )
3030
3131 const { data : canManage = false , isLoading } = useCanPublishCustomBlock ( workspaceId )
32- const { data : blocks = [ ] } = useCustomBlocks ( workspaceId )
32+ const { data : blocks = [ ] , isPending : blocksPending } = useCustomBlocks ( workspaceId )
3333 const { data : workspaces = [ ] } = useWorkspacesQuery ( )
3434
3535 /** Publishing requires admin on a source workspace; viewing remains workspace-scoped. */
@@ -63,7 +63,12 @@ export function CustomBlocks() {
6363 /** Open the detail only once the deep-linked id resolves to a loaded block. */
6464 const selectedBlock = selectedBlockId ? blocks . find ( ( b ) => b . id === selectedBlockId ) : undefined
6565
66- if ( isLoading ) return null
66+ /**
67+ * Hold the first paint while a deep-linked id could still resolve, so a
68+ * valid link never flashes the list before jumping to the detail (a dead id
69+ * falls back to the list once the blocks load).
70+ */
71+ if ( isLoading || ( selectedBlockId && canAdmin && blocksPending ) ) return null
6772
6873 if ( ! canManage ) {
6974 return (
You can’t perform that action at this time.
0 commit comments