Skip to content

Commit 52e43bb

Browse files
committed
refactor(resources): close the two route-tree edges the migration created
A canonical unit is mounted by anonymous surfaces, so an import of the authenticated route tree from inside one pulls the workspace bundle into the public chunk and re-creates exactly the coupling the axes exist to delete. The migration introduced two, and R3b's inherited 37-file budget was wide enough to hide both. - The collaborative socket provider moves to `components/socket-provider`. It has consumers on both sides of the route tree — the workspace editor mounts it, and the file view's collaboration hook reads it from inside a unit — so `app/workspace/providers/**` was never its home. Same fix, and same reasoning, as the earlier `ActionRow` / `AnchoredContextMenu` moves. - `DELETED_WORKFLOW_LABEL` moves to `lib/workflows/labels.ts`. It is a workflow concept, not a log one: four of its five consumers are workflow-editor surfaces, and sourcing it from the log-view barrel made `lib/workflows/ subblocks/display.ts` — reachable from server routes — drag a 762-line 'use client' module behind it. - The log view's frozen-canvas modal keeps its `Preview` import, annotated. That component reads useParams<{ workspaceId }>() and pulls in the editor's subblock and edge components; it IS editor UI, and hoisting it would drag half the editor into components/. It is safe only because `log`'s share seed is `never`. Adds R3c to check:resources, held at 0: the same edge R3b counts, narrowed to canonical units, where there is no budget. Verified it fails by removing the annotation and watching the audit go red.
1 parent 3b09102 commit 52e43bb

27 files changed

Lines changed: 108 additions & 33 deletions

File tree

apps/sim/app/workspace/[workspaceId]/hooks/use-workspace-invalidation-room.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useEffect, useRef } from 'react'
44
import { createLogger } from '@sim/logger'
55
import type { RoomType } from '@sim/realtime-protocol/rooms'
6-
import { useSocket } from '@/app/workspace/providers/socket-provider'
6+
import { useSocket } from '@/components/socket-provider'
77

88
const logger = createLogger('WorkspaceInvalidationRoom')
99

apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/workflows-list/workflows-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { memo } from 'react'
22
import { cn, handleKeyboardActivation } from '@sim/emcn'
33
import { Workflow } from '@sim/emcn/icons'
4-
import { DELETED_WORKFLOW_LABEL } from '@/components/resources/log-view'
4+
import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/labels'
55
import { FloatingOverflowText } from '@/app/workspace/[workspaceId]/components'
66
import { StatusBar, type StatusBarSegment } from '..'
77

apps/sim/app/workspace/[workspaceId]/logs/logs.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ import {
3434
STATUS_CONFIG,
3535
StatusBadge,
3636
} from '@/components/execution-status'
37-
import {
38-
DELETED_WORKFLOW_LABEL,
39-
ExecutionSnapshot,
40-
formatDate,
41-
TriggerBadge,
42-
} from '@/components/resources/log-view'
37+
import { ExecutionSnapshot, formatDate, TriggerBadge } from '@/components/resources/log-view'
4338
import type {
4439
WorkflowLogDetail,
4540
WorkflowLogRow,
@@ -61,6 +56,7 @@ import {
6156
type WorkflowData,
6257
} from '@/lib/logs/search-suggestions'
6358
import { SEARCH_DEBOUNCE_MS } from '@/lib/url-state'
59+
import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/labels'
6460
import type {
6561
FilterTag,
6662
ResourceAction,

apps/sim/app/workspace/[workspaceId]/providers/workspace-permissions-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useToast } from '@sim/emcn'
66
import { createLogger } from '@sim/logger'
77
import { useQueryClient } from '@tanstack/react-query'
88
import { useParams } from 'next/navigation'
9-
import { useSocket } from '@/app/workspace/providers/socket-provider'
9+
import { useSocket } from '@/components/socket-provider'
1010
import {
1111
useWorkspacePermissionsQuery,
1212
type WorkspacePermissions,

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/hooks/use-table-room.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '@sim/realtime-protocol/table-presence'
1414
import { generateShortId } from '@sim/utils/id'
1515
import type { PresenceAvatarUser } from '@/components/presence'
16-
import { useSocket } from '@/app/workspace/providers/socket-provider'
16+
import { useSocket } from '@/components/socket-provider'
1717

1818
const logger = createLogger('TableRoom')
1919

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/cursors/cursors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import { memo, useMemo } from 'react'
44
import { useViewport } from 'reactflow'
5+
import { useSocket } from '@/components/socket-provider'
56
import { getUserColor } from '@/lib/workspaces/colors'
67
import { usePreventZoom } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks'
7-
import { useSocket } from '@/app/workspace/providers/socket-provider'
88
import { usePresenceStore } from '@/stores/presence/store'
99
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
1010

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/workflow-selector/workflow-selector-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useMemo } from 'react'
44
import { useParams } from 'next/navigation'
5-
import { DELETED_WORKFLOW_LABEL } from '@/components/resources/log-view'
5+
import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/labels'
66
import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox'
77
import type { SubBlockConfig } from '@/blocks/types'
88
import type { SelectorContext } from '@/hooks/selectors/types'

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { generateId } from '@sim/utils/id'
1919
import type { SubflowNodeData } from '@sim/workflow-renderer'
2020
import { BLOCK_DIMENSIONS, CONTAINER_DIMENSIONS } from '@sim/workflow-renderer'
2121
import { useShallow } from 'zustand/react/shallow'
22+
import { useSocket } from '@/components/socket-provider'
2223
import { useSession } from '@/lib/auth/auth-client'
2324
import type { OAuthConnectEventDetail } from '@/lib/copilot/tools/client/base-tool'
2425
import { consumeOAuthReturnContext, writeOAuthReturnContext } from '@/lib/credentials/client-state'
@@ -77,7 +78,6 @@ import {
7778
reactFlowProOptions,
7879
reactFlowStyles,
7980
} from '@/app/workspace/[workspaceId]/w/[workflowId]/workflow-constants'
80-
import { useSocket } from '@/app/workspace/providers/socket-provider'
8181
import { getBlock } from '@/blocks'
8282
import { isAnnotationOnlyBlock } from '@/executor/constants'
8383
import { useCustomBlocks } from '@/hooks/queries/custom-blocks'

apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
import { formatDuration } from '@sim/utils/formatting'
3131
import { useParams } from 'next/navigation'
3232
import { ReactFlowProvider } from 'reactflow'
33-
import { DELETED_WORKFLOW_LABEL } from '@/components/resources/log-view'
33+
import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/labels'
3434
import { extractReferencePrefixes } from '@/lib/workflows/sanitization/references'
3535
import {
3636
buildCanonicalIndex,

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/avatars/avatars.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useMemo } from 'react'
44
import { PresenceAvatars } from '@/components/presence'
5-
import { useSocket } from '@/app/workspace/providers/socket-provider'
5+
import { useSocket } from '@/components/socket-provider'
66
import { SIDEBAR_WIDTH } from '@/stores/constants'
77
import { usePresenceStore } from '@/stores/presence/store'
88
import { useSidebarStore } from '@/stores/sidebar/store'

0 commit comments

Comments
 (0)