Skip to content

Commit

Permalink
fix: remove playground results flip (#4076)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Jun 23, 2023
1 parent 7a5c773 commit 175b103
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions frontend/src/component/playground/Playground/AdvancedPlayground.tsx
Expand Up @@ -57,6 +57,7 @@ export const AdvancedPlayground: VFC<{
const [searchParams, setSearchParams] = useSearchParams();
const searchParamsLength = Array.from(searchParams.entries()).length;
const { evaluateAdvancedPlayground, loading } = usePlaygroundApi();
const [hasFormBeenSubmitted, setHasFormBeenSubmitted] = useState(false);

useEffect(() => {
if (environments?.length === 0) {
Expand Down Expand Up @@ -167,6 +168,8 @@ export const AdvancedPlayground: VFC<{
const onSubmit: FormEventHandler<HTMLFormElement> = async event => {
event.preventDefault();

setHasFormBeenSubmitted(true);

await evaluatePlaygroundContext(environments, projects, context, () => {
setURLParameters();
setValue({
Expand Down Expand Up @@ -272,17 +275,25 @@ export const AdvancedPlayground: VFC<{
condition={loading}
show={<Loader />}
elseShow={
<ConditionallyRender
condition={Boolean(results)}
show={
<AdvancedPlaygroundResultsTable
loading={loading}
features={results?.features}
input={results?.input}
/>
}
elseShow={<PlaygroundGuidance />}
/>
<>
<ConditionallyRender
condition={Boolean(results)}
show={
<AdvancedPlaygroundResultsTable
loading={loading}
features={results?.features}
input={results?.input}
/>
}
/>
<ConditionallyRender
condition={
!Boolean(results) &&
!hasFormBeenSubmitted
}
show={<PlaygroundGuidance />}
/>
</>
}
/>
</Box>
Expand Down

0 comments on commit 175b103

Please sign in to comment.