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 [searchParams, setSearchParams] = useSearchParams();
const searchParamsLength = Array.from(searchParams.entries()).length; const searchParamsLength = Array.from(searchParams.entries()).length;
const { evaluateAdvancedPlayground, loading } = usePlaygroundApi(); const { evaluateAdvancedPlayground, loading } = usePlaygroundApi();
const [hasFormBeenSubmitted, setHasFormBeenSubmitted] = useState(false);
useEffect(() => { useEffect(() => {
if (environments?.length === 0) { if (environments?.length === 0) {
@ -167,6 +168,8 @@ export const AdvancedPlayground: VFC<{
const onSubmit: FormEventHandler<HTMLFormElement> = async event => { const onSubmit: FormEventHandler<HTMLFormElement> = async event => {
event.preventDefault(); event.preventDefault();
setHasFormBeenSubmitted(true);
await evaluatePlaygroundContext(environments, projects, context, () => { await evaluatePlaygroundContext(environments, projects, context, () => {
setURLParameters(); setURLParameters();
setValue({ setValue({
@ -272,17 +275,25 @@ export const AdvancedPlayground: VFC<{
condition={loading} condition={loading}
show={<Loader />} show={<Loader />}
elseShow={ elseShow={
<ConditionallyRender <>
condition={Boolean(results)} <ConditionallyRender
show={ condition={Boolean(results)}
<AdvancedPlaygroundResultsTable show={
loading={loading} <AdvancedPlaygroundResultsTable
features={results?.features} loading={loading}
input={results?.input} features={results?.features}
/> input={results?.input}
} />
elseShow={<PlaygroundGuidance />} }
/> />
<ConditionallyRender
condition={
!Boolean(results) &&
!hasFormBeenSubmitted
}
show={<PlaygroundGuidance />}
/>
</>
} }
/> />
</Box> </Box>