diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e0c543ce7..29db752e24 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, + "editor.formatOnSave": false, "typescript.tsdk": "node_modules/typescript/lib", "javascript.preferences.importModuleSpecifier": "relative", -} +} \ No newline at end of file diff --git a/packages/react-ui/.eslintrc.json b/packages/react-ui/.eslintrc.json index a59c6432cc..a67a2a0d46 100644 --- a/packages/react-ui/.eslintrc.json +++ b/packages/react-ui/.eslintrc.json @@ -130,11 +130,16 @@ "@typescript-eslint/no-explicit-any": [ "off" ], + "@typescript-eslint/indent": "off", "prettier/prettier": [ "error", - {}, { - "usePrettierrc": true + "singleQuote": true, + "trailingComma": "all", + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "jsxBracketSameLine": false } ] } diff --git a/packages/react-ui/.prettierrc b/packages/react-ui/.prettierrc deleted file mode 100644 index 900f8a0ad3..0000000000 --- a/packages/react-ui/.prettierrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "all", - "printWidth": 80, - "tabWidth": 2, - "useTabs": false -} \ No newline at end of file diff --git a/packages/react-ui/src/app/builder/builder-hooks.ts b/packages/react-ui/src/app/builder/builder-hooks.ts index eb6666b3d7..d9730ca030 100644 --- a/packages/react-ui/src/app/builder/builder-hooks.ts +++ b/packages/react-ui/src/app/builder/builder-hooks.ts @@ -114,18 +114,31 @@ export type BuilderInitialState = Pick< export type BuilderStore = ReturnType; +function determineInitiallySelectedStep( + failedStepInRun: string | null, + flowVersion: FlowVersion, +): string | null { + if (failedStepInRun) { + return failedStepInRun; + } + if (flowVersion.state === FlowVersionState.LOCKED) { + return null; + } + return ( + flowStructureUtil.getAllSteps(flowVersion.trigger).find((s) => !s.valid) + ?.name ?? 'trigger' + ); +} + export const createBuilderStore = (initialState: BuilderInitialState) => create((set) => { const failedStepInRun = initialState.run?.steps ? flowRunUtils.findFailedStepInOutput(initialState.run.steps) : null; - const initiallySelectedStep = - failedStepInRun ?? - initialState.flowVersion.state === FlowVersionState.LOCKED - ? null - : flowStructureUtil - .getAllSteps(initialState.flowVersion.trigger) - .find((s) => !s.valid)?.name ?? 'trigger'; + const initiallySelectedStep = determineInitiallySelectedStep( + failedStepInRun, + initialState.flowVersion, + ); return { loopsIndexes: initialState.run && initialState.run.steps diff --git a/packages/react-ui/src/app/builder/index.tsx b/packages/react-ui/src/app/builder/index.tsx index 4189fdd6f5..9dbb94f140 100644 --- a/packages/react-ui/src/app/builder/index.tsx +++ b/packages/react-ui/src/app/builder/index.tsx @@ -125,7 +125,6 @@ const BuilderPage = () => { const leftSidePanelRef = useRef(null); const rightSidePanelRef = useRef(null); - const { versions, refetch: refetchPiece } = piecesHooks.useMostRecentAndExactPieceVersion({ name: memorizedSelectedStep?.settings.pieceName, @@ -182,35 +181,31 @@ const BuilderPage = () => { - <> - -
- {leftSidebar === LeftSideBarType.RUNS && } - {leftSidebar === LeftSideBarType.RUN_DETAILS && ( - - )} - {leftSidebar === LeftSideBarType.VERSIONS && } - {leftSidebar === LeftSideBarType.AI_COPILOT && } -
-
- - + +
+ {leftSidebar === LeftSideBarType.RUNS && } + {leftSidebar === LeftSideBarType.RUN_DETAILS && } + {leftSidebar === LeftSideBarType.VERSIONS && } + {leftSidebar === LeftSideBarType.AI_COPILOT && } +
+
+
diff --git a/packages/react-ui/src/lib/utils.ts b/packages/react-ui/src/lib/utils.ts index 04d4cf0197..e88f2d73e5 100644 --- a/packages/react-ui/src/lib/utils.ts +++ b/packages/react-ui/src/lib/utils.ts @@ -87,7 +87,6 @@ export const formatUtils = { remainingSeconds > 0 ? ` ${remainingSeconds} seconds` : '' }`; } - return short ? `${seconds} s` : `${seconds} seconds`; }, };