Process UX feedback for DownloadDialog (#942)

This commit is contained in:
Jon Koops 2021-08-05 12:42:29 +02:00 committed by GitHub
parent be0506653d
commit 25376c75fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ import {
TextArea,
} from "@patternfly/react-core";
import FileSaver from "file-saver";
import React, { useMemo, useState } from "react";
import React, { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
@ -65,6 +65,10 @@ export const DownloadDialog = ({
(snippet) => setSnippet(snippet),
[id, selected]
);
// Clear snippet when selected config changes, this prevents old snippets from being displayed during fetch.
useEffect(() => setSnippet(""), [id, selected]);
return (
<ConfirmDialogModal
titleKey={t("clients:downloadAdaptorTitle")}
@ -113,9 +117,7 @@ export const DownloadDialog = ({
<Select
toggleId="type"
isOpen={openType}
onToggle={() => {
setOpenType(!openType);
}}
onToggle={(isExpanded) => setOpenType(isExpanded)}
variant={SelectVariant.single}
value={selected}
selections={selected}