diff --git a/packages/backend/src/graphql/queries/get-step-with-test-executions.ts b/packages/backend/src/graphql/queries/get-step-with-test-executions.ts index 9030195b..ff7b93ea 100644 --- a/packages/backend/src/graphql/queries/get-step-with-test-executions.ts +++ b/packages/backend/src/graphql/queries/get-step-with-test-executions.ts @@ -16,14 +16,13 @@ const getStepWithTestExecutions = async ( const previousStepsWithCurrentStep = await context.currentUser .$relatedQuery('steps') - .withGraphJoined('executionSteps') + .withGraphFetched('executionSteps') + .modifyGraph('executionSteps', (builder) => { + builder.orderBy('created_at', 'desc').limit(1); + }) .where('flow_id', '=', step.flowId) .andWhere('position', '<', step.position) - .distinctOn('executionSteps.step_id') - .orderBy([ - 'executionSteps.step_id', - { column: 'executionSteps.created_at', order: 'desc' }, - ]); + .orderBy('steps.position', 'asc'); return previousStepsWithCurrentStep; }; diff --git a/packages/web/src/components/PowerInput/Suggestions.tsx b/packages/web/src/components/PowerInput/Suggestions.tsx index 451344ef..7f3c87e0 100644 --- a/packages/web/src/components/PowerInput/Suggestions.tsx +++ b/packages/web/src/components/PowerInput/Suggestions.tsx @@ -38,10 +38,10 @@ const Suggestions = (props: SuggestionsProps) => { onSuggestionClick = () => null, } = props; const [current, setCurrent] = React.useState(0); - const [listLength, setListLength] = React.useState(SHORT_LIST_LENGTH); + const [listLength, setListLength] = React.useState(SHORT_LIST_LENGTH); const expandList = () => { - setListLength(undefined); + setListLength(Infinity); }; const collapseList = () => { @@ -72,7 +72,7 @@ const Suggestions = (props: SuggestionsProps) => { primary={option.name} /> - {option.output?.length && ( + {!!option.output?.length && ( current === index ? : )} @@ -105,7 +105,7 @@ const Suggestions = (props: SuggestionsProps) => { } - {listLength && ( + {option.output?.length > listLength && (