only update snippet when component is mounted (#191)
* only update snippet when component is mounted fixing: #190 * removed debug console.log
This commit is contained in:
parent
b618ab245e
commit
52afed2b64
1 changed files with 10 additions and 2 deletions
|
@ -4,6 +4,7 @@ import {
|
|||
AlertVariant,
|
||||
Form,
|
||||
FormGroup,
|
||||
ModalVariant,
|
||||
Select,
|
||||
SelectOption,
|
||||
SelectVariant,
|
||||
|
@ -66,13 +67,19 @@ export const DownloadDialog = ({
|
|||
const [openType, setOpenType] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let isMounted = true;
|
||||
(async () => {
|
||||
const response = await httpClient.doGet<string>(
|
||||
`/admin/realms/${realm}/clients/${id}/installation/providers/${selected}`
|
||||
);
|
||||
setSnippet(await response.text());
|
||||
if (isMounted) {
|
||||
setSnippet(await response.text());
|
||||
}
|
||||
})();
|
||||
}, [selected, snippet]);
|
||||
return () => {
|
||||
isMounted = false;
|
||||
};
|
||||
}, [selected]);
|
||||
return (
|
||||
<ConfirmDialogModal
|
||||
titleKey={t("clients:downloadAdaptorTitle")}
|
||||
|
@ -86,6 +93,7 @@ export const DownloadDialog = ({
|
|||
}}
|
||||
open={open}
|
||||
toggleDialog={toggleDialog}
|
||||
variant={ModalVariant.medium}
|
||||
>
|
||||
<Form>
|
||||
<Stack hasGutter>
|
||||
|
|
Loading…
Reference in a new issue