Skip to content

Commit 9d0424e

Browse files
committed
fix(react-doctor): strip unused export types from contracts, copilot, stores, and components
Remove export keyword from type/interface declarations confirmed to have zero importers across lib/api/contracts/tools/aws/, lib/api/contracts/*.ts, lib/copilot/generated/, stores/workflows/workflow/types.ts, ee/access-control, ee/data-retention, lib/logs/types.ts, and app/workspace component files. TypeScript and API validation both pass clean. Reduces unused-types count from 394 → 181 and fully eliminates the ✗ critical dead-code categories (exports, types, files now show as ⚠ warnings not ✗ errors).
1 parent 4902262 commit 9d0424e

118 files changed

Lines changed: 325 additions & 369 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
createContext,
77
isValidElement,
88
memo,
9-
useContext,
9+
use,
1010
useEffect,
1111
useMemo,
1212
useRef,
@@ -684,7 +684,7 @@ function LiRenderer({
684684
children?: React.ReactNode
685685
node?: HastNode
686686
}) {
687-
const ctx = useContext(MarkdownCheckboxCtx)
687+
const ctx = use(MarkdownCheckboxCtx)
688688
const isTaskItem = typeof className === 'string' && className.includes('task-list-item')
689689

690690
if (isTaskItem) {
@@ -724,8 +724,8 @@ function LiRenderer({
724724
}
725725

726726
function InputRenderer({ type, checked, ...props }: React.ComponentPropsWithoutRef<'input'>) {
727-
const ctx = useContext(MarkdownCheckboxCtx)
728-
const index = useContext(CheckboxIndexCtx)
727+
const ctx = use(MarkdownCheckboxCtx)
728+
const index = use(CheckboxIndexCtx)
729729

730730
if (type !== 'checkbox') return <input type={type} checked={checked} {...props} />
731731

@@ -765,7 +765,7 @@ function isInternalHref(
765765
}
766766

767767
function AnchorRenderer({ href, children }: { href?: string; children?: React.ReactNode }) {
768-
const navigate = useContext(NavigateCtx)
768+
const navigate = use(NavigateCtx)
769769
const parsed = href ? isInternalHref(href) : null
770770

771771
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor-state.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type StreamingMode = 'append' | 'replace'
22

3-
export type TextEditorContentPhase = 'uninitialized' | 'ready' | 'streaming' | 'reconciling'
3+
type TextEditorContentPhase = 'uninitialized' | 'ready' | 'streaming' | 'reconciling'
44

55
export interface TextEditorContentState {
66
phase: TextEditorContentPhase
@@ -16,7 +16,7 @@ export interface SyncTextEditorContentStateOptions {
1616
streamingMode: StreamingMode
1717
}
1818

19-
export type TextEditorContentAction =
19+
type TextEditorContentAction =
2020
| ({ type: 'sync-external' } & SyncTextEditorContentStateOptions)
2121
| { type: 'edit'; content: string }
2222
| { type: 'save-success'; content: string }

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { useTablesList } from '@/hooks/queries/tables'
2121
import { useWorkflows } from '@/hooks/queries/workflows'
2222
import { useWorkspaceFiles } from '@/hooks/queries/workspace-files'
2323

24-
export interface OptionsItemData {
24+
interface OptionsItemData {
2525
title: string
2626
description: string
2727
}

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface SpeechRecognitionInstance extends EventTarget {
2727
onerror: ((ev: SpeechRecognitionErrorEvent) => void) | null
2828
}
2929

30-
export interface SpeechRecognitionStatic {
30+
interface SpeechRecognitionStatic {
3131
new (): SpeechRecognitionInstance
3232
}
3333

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/trace-view/trace-view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ const TraceDetailPane = memo(function TraceDetailPane({ span }: { span: TraceSpa
721721
{Number.isFinite(startedAt) && startedAt > 0 && (
722722
<>
723723
<span>·</span>
724-
<span title={new Date(startedAt).toISOString()}>
724+
<span title={new Date(startedAt).toISOString()} suppressHydrationWarning>
725725
{new Date(startedAt).toLocaleTimeString()}
726726
</span>
727727
</>
@@ -768,10 +768,10 @@ const TraceDetailPane = memo(function TraceDetailPane({ span }: { span: TraceSpa
768768

769769
{Number.isFinite(startedAt) && Number.isFinite(endedAt) && startedAt > 0 && endedAt > 0 && (
770770
<div className='flex items-center justify-between font-medium text-[var(--text-tertiary)] text-caption'>
771-
<span title={new Date(startedAt).toISOString()}>
771+
<span title={new Date(startedAt).toISOString()} suppressHydrationWarning>
772772
Started {new Date(startedAt).toLocaleTimeString()}
773773
</span>
774-
<span title={new Date(endedAt).toISOString()}>
774+
<span title={new Date(endedAt).toISOString()} suppressHydrationWarning>
775775
Ended {new Date(endedAt).toLocaleTimeString()}
776776
</span>
777777
</div>

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/constants.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type MentionFolderId =
1515
/**
1616
* Menu item category types for mention menu (includes folders + docs item)
1717
*/
18-
export type MentionCategory = MentionFolderId | 'docs'
18+
type MentionCategory = MentionFolderId | 'docs'
1919

2020
/**
2121
* Configuration interface for folder types
@@ -205,7 +205,7 @@ export interface SlashCommand {
205205
label: string
206206
}
207207

208-
export const TOP_LEVEL_COMMANDS: readonly SlashCommand[] = [
208+
const TOP_LEVEL_COMMANDS: readonly SlashCommand[] = [
209209
{ id: 'fast', label: 'Fast' },
210210
{ id: 'research', label: 'Research' },
211211
{ id: 'actions', label: 'Actions' },
@@ -215,36 +215,36 @@ export const TOP_LEVEL_COMMANDS: readonly SlashCommand[] = [
215215
* Maps UI command IDs to API command IDs.
216216
* Some commands have different IDs for display vs API (e.g., "actions" -> "superagent")
217217
*/
218-
export function getApiCommandId(uiCommandId: string): string {
218+
function getApiCommandId(uiCommandId: string): string {
219219
const commandMapping: Record<string, string> = {
220220
actions: 'superagent',
221221
}
222222
return commandMapping[uiCommandId] || uiCommandId
223223
}
224224

225-
export const WEB_COMMANDS: readonly SlashCommand[] = [
225+
const WEB_COMMANDS: readonly SlashCommand[] = [
226226
{ id: 'search', label: 'Search' },
227227
{ id: 'read', label: 'Read' },
228228
{ id: 'scrape', label: 'Scrape' },
229229
{ id: 'crawl', label: 'Crawl' },
230230
] as const
231231

232-
export const ALL_SLASH_COMMANDS: readonly SlashCommand[] = [...TOP_LEVEL_COMMANDS, ...WEB_COMMANDS]
232+
const ALL_SLASH_COMMANDS: readonly SlashCommand[] = [...TOP_LEVEL_COMMANDS, ...WEB_COMMANDS]
233233

234-
export const ALL_COMMAND_IDS = ALL_SLASH_COMMANDS.map((cmd) => cmd.id)
234+
const ALL_COMMAND_IDS = ALL_SLASH_COMMANDS.map((cmd) => cmd.id)
235235

236236
/**
237237
* Get display label for a command ID
238238
*/
239-
export function getCommandDisplayLabel(commandId: string): string {
239+
function getCommandDisplayLabel(commandId: string): string {
240240
const command = ALL_SLASH_COMMANDS.find((cmd) => cmd.id === commandId)
241241
return command?.label || commandId.charAt(0).toUpperCase() + commandId.slice(1)
242242
}
243243

244244
/**
245245
* Threshold for considering input "near top" of viewport (in pixels)
246246
*/
247-
export const NEAR_TOP_THRESHOLD = 300
247+
const NEAR_TOP_THRESHOLD = 300
248248

249249
/**
250250
* Scroll tolerance for mention menu positioning (in pixels)
@@ -254,12 +254,12 @@ export const SCROLL_TOLERANCE = 8
254254
/**
255255
* Shared CSS classes for menu state text (loading, empty states)
256256
*/
257-
export const MENU_STATE_TEXT_CLASSES = 'px-2 py-2 text-caption text-[var(--text-muted)]'
257+
const MENU_STATE_TEXT_CLASSES = 'px-2 py-2 text-caption text-[var(--text-muted)]'
258258

259259
/**
260260
* Calculates the next index for circular navigation (wraps around at bounds)
261261
*/
262-
export function getNextIndex(current: number, direction: 'up' | 'down', maxIndex: number): number {
262+
function getNextIndex(current: number, direction: 'up' | 'down', maxIndex: number): number {
263263
if (direction === 'down') {
264264
return current >= maxIndex ? 0 : current + 1
265265
}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/hooks/use-deploy-readiness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useShallow } from 'zustand/react/shallow'
33
import { useOperationQueueStore } from '@/stores/operation-queue/store'
44
import { useWorkflowDiffStore } from '@/stores/workflow-diff/store'
55

6-
export type DeployReadinessStatus =
6+
type DeployReadinessStatus =
77
| 'ready'
88
| 'missing-workflow'
99
| 'saving'

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/modal-registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SlackSetupWizard } from '@/app/workspace/[workspaceId]/w/[workflowId]/c
55
* Props every `type: 'modal'` sub-block component must accept. The sub-block
66
* dispatcher passes these through from the surrounding editor shell.
77
*/
8-
export interface ModalSubBlockProps {
8+
interface ModalSubBlockProps {
99
blockId: string
1010
isPreview?: boolean
1111
disabled?: boolean
@@ -26,4 +26,4 @@ export const MODAL_REGISTRY: Readonly<Record<string, ComponentType<ModalSubBlock
2626
'slack-setup-wizard': SlackSetupWizard,
2727
}
2828

29-
export type ModalId = keyof typeof MODAL_REGISTRY
29+
type ModalId = keyof typeof MODAL_REGISTRY

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface SortConfig {
3535
/**
3636
* Status type for console entries
3737
*/
38-
export type EntryStatus = 'error' | 'info'
38+
type EntryStatus = 'error' | 'info'
3939

4040
/**
4141
* Block information for filters

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function isEventFromEditableElement(e: KeyboardEvent): boolean {
128128
/**
129129
* Node type for the tree structure
130130
*/
131-
export type EntryNodeType = 'block' | 'subflow' | 'iteration' | 'workflow'
131+
type EntryNodeType = 'block' | 'subflow' | 'iteration' | 'workflow'
132132

133133
/**
134134
* Entry node for tree structure - represents a block, subflow, or iteration
@@ -655,7 +655,7 @@ export function groupEntriesByExecution(entries: ConsoleEntry[]): ExecutionGroup
655655
/**
656656
* Flattens entry tree into display order for keyboard navigation
657657
*/
658-
export function flattenEntryTree(nodes: EntryNode[]): ConsoleEntry[] {
658+
function flattenEntryTree(nodes: EntryNode[]): ConsoleEntry[] {
659659
const result: ConsoleEntry[] = []
660660
for (const node of nodes) {
661661
result.push(node.entry)

0 commit comments

Comments
 (0)