1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

fix: remove playground results flip (#4076)

This commit is contained in:
Mateusz Kwasniewski 2023-06-23 09:28:49 +02:00 committed by GitHub
parent 7a5c77376a
commit 175b103b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {
@ -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({
@ -272,6 +275,7 @@ export const AdvancedPlayground: VFC<{
condition={loading}
show={<Loader />}
elseShow={
<>
<ConditionallyRender
condition={Boolean(results)}
show={
@ -281,8 +285,15 @@ export const AdvancedPlayground: VFC<{
input={results?.input}
/>
}
elseShow={<PlaygroundGuidance />}
/>
<ConditionallyRender
condition={
!Boolean(results) &&
!hasFormBeenSubmitted
}
show={<PlaygroundGuidance />}
/>
</>
}
/>
</Box>