Rework floating promises to avoid concurrency side effects

Closes #40739

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Co-authored-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Alexander Schwartz 2025-07-08 19:43:15 +02:00 committed by GitHub
parent 70f4acdf43
commit 2e613dea27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 131 additions and 129 deletions

View File

@ -111,8 +111,8 @@ export const AccountRow = ({
<Button <Button
id={`${account.providerAlias}-idp-link`} id={`${account.providerAlias}-idp-link`}
variant="link" variant="link"
onClick={() => { onClick={async () => {
login({ await login({
action: "idp_link:" + account.providerAlias, action: "idp_link:" + account.providerAlias,
}); });
}} }}

View File

@ -69,7 +69,7 @@ export const DeviceActivity = () => {
const signOutAll = async () => { const signOutAll = async () => {
await deleteSession(context); await deleteSession(context);
context.keycloak.logout(); await context.keycloak.logout();
}; };
const signOutSession = async ( const signOutSession = async (

View File

@ -266,8 +266,8 @@ export const SigningIn = () => {
<Button <Button
variant="danger" variant="danger"
data-testrole="remove" data-testrole="remove"
onClick={() => { onClick={async () => {
login({ await login({
action: action:
"delete_credential:" + "delete_credential:" +
meta.credential.id, meta.credential.id,
@ -280,8 +280,10 @@ export const SigningIn = () => {
{container.updateAction && ( {container.updateAction && (
<Button <Button
variant="secondary" variant="secondary"
onClick={() => { onClick={async () => {
login({ action: container.updateAction }); await login({
action: container.updateAction,
});
}} }}
data-testrole="update" data-testrole="update"
> >

View File

@ -51,6 +51,7 @@ export const Oid4Vci = () => {
useEffect(() => { useEffect(() => {
if (initialSelected !== selected && credentialsIssuer !== undefined) { if (initialSelected !== selected && credentialsIssuer !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
requestVCOffer(context, selectOptions[selected], credentialsIssuer).then( requestVCOffer(context, selectOptions[selected], credentialsIssuer).then(
(blob) => { (blob) => {
const reader = new FileReader(); const reader = new FileReader();

View File

@ -105,15 +105,15 @@ export const PermissionRequest = ({
</Td> </Td>
<Td> <Td>
<Button <Button
onClick={() => { onClick={async () => {
approveDeny(shareRequest, true); await approveDeny(shareRequest, true);
}} }}
> >
{t("accept")} {t("accept")}
</Button> </Button>
<Button <Button
onClick={() => { onClick={async () => {
approveDeny(shareRequest); await approveDeny(shareRequest);
}} }}
className="pf-v5-u-ml-sm" className="pf-v5-u-ml-sm"
variant="danger" variant="danger"

View File

@ -66,7 +66,7 @@ export function usePromise<T>(
} }
} }
handlePromise(); void handlePromise();
// Abort the Promise when the component unmounts, or the dependencies change. // Abort the Promise when the component unmounts, or the dependencies change.
return () => controller.abort(); return () => controller.abort();

View File

@ -18,7 +18,7 @@ test.describe("Signing in", () => {
await page.getByTestId("accountSecurity").click(); await page.getByTestId("accountSecurity").click();
await expect(page.getByTestId("account-security/signing-in")).toBeVisible(); await expect(page.getByTestId("account-security/signing-in")).toBeVisible();
page.getByTestId("account-security/signing-in").click(); await page.getByTestId("account-security/signing-in").click();
await expect( await expect(
page.getByTestId("password/credential-list").getByRole("listitem"), page.getByTestId("password/credential-list").getByRole("listitem"),
@ -54,11 +54,11 @@ test.describe("Signing in 2", () => {
await login(page, "jdoe", "jdoe", "groups"); await login(page, "jdoe", "jdoe", "groups");
const credentials = await getCredentials(jdoeUser!.id!, realm); const credentials = await getCredentials(jdoeUser!.id!, realm);
deleteCredential(jdoeUser!.id!, credentials![0].id!, realm); await deleteCredential(jdoeUser!.id!, credentials![0].id!, realm);
await page.getByTestId("accountSecurity").click(); await page.getByTestId("accountSecurity").click();
await expect(page.getByTestId("account-security/signing-in")).toBeVisible(); await expect(page.getByTestId("account-security/signing-in")).toBeVisible();
page.getByTestId("account-security/signing-in").click(); await page.getByTestId("account-security/signing-in").click();
await expect( await expect(
page.getByTestId("password/credential-list").getByRole("listitem"), page.getByTestId("password/credential-list").getByRole("listitem"),

View File

@ -58,7 +58,7 @@ export async function createIdentityProvider(
idp: IdentityProviderRepresentation, idp: IdentityProviderRepresentation,
realm = DEFAULT_REALM, realm = DEFAULT_REALM,
): Promise<string> { ): Promise<string> {
return adminClient.identityProviders.create({ ...idp, realm })["id"]; return (await adminClient.identityProviders.create({ ...idp, realm }))["id"];
} }
export async function deleteIdentityProvider( export async function deleteIdentityProvider(

View File

@ -434,7 +434,7 @@ export default function FlowDetails() {
const [removed] = order.splice(source.index, 1); const [removed] = order.splice(source.index, 1);
order.splice(dest.index, 0, removed); order.splice(dest.index, 0, removed);
const change = executionList.getChange(dragged, order); const change = executionList.getChange(dragged, order);
executeChange(dragged, change); void executeChange(dragged, change);
return true; return true;
} else { } else {
setLiveText(t("onDragCancel")); setLiveText(t("onDragCancel"));
@ -482,9 +482,9 @@ export default function FlowDetails() {
type={ type={
flow.providerId === "client-flow" ? "client" : "basic" flow.providerId === "client-flow" ? "client" : "basic"
} }
onSelect={(type) => { onSelect={async (type) => {
if (type) { if (type) {
addExecution(flow.alias!, type); await addExecution(flow.alias!, type);
} }
setShowAddExecutionDialog(false); setShowAddExecutionDialog(false);
}} }}
@ -494,8 +494,8 @@ export default function FlowDetails() {
<AddSubFlowModal <AddSubFlowModal
name={flow.alias!} name={flow.alias!}
onCancel={() => setShowSubFlowDialog(false)} onCancel={() => setShowSubFlowDialog(false)}
onConfirm={(newFlow) => { onConfirm={async (newFlow) => {
addFlow(flow.alias!, newFlow); await addFlow(flow.alias!, newFlow);
setShowSubFlowDialog(false); setShowSubFlowDialog(false);
}} }}
/> />

View File

@ -160,7 +160,7 @@ export const RequiredActions = () => {
if (!dragged.alias) return; if (!dragged.alias) return;
const times = newIndex - oldIndex; const times = newIndex - oldIndex;
executeMove(dragged, times); await executeMove(dragged, times);
}} }}
columns={[ columns={[
{ {
@ -177,8 +177,8 @@ export const RequiredActions = () => {
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={row.enabled} isChecked={row.enabled}
onChange={() => { onChange={async () => {
updateAction(row.data, "enabled"); await updateAction(row.data, "enabled");
}} }}
aria-label={row.name} aria-label={row.name}
/> />
@ -196,8 +196,8 @@ export const RequiredActions = () => {
isDisabled={!row.enabled} isDisabled={!row.enabled}
labelOff={!row.enabled ? t("disabledOff") : t("off")} labelOff={!row.enabled ? t("disabledOff") : t("off")}
isChecked={row.defaultAction} isChecked={row.defaultAction}
onChange={() => { onChange={async () => {
updateAction(row.data, "defaultAction"); await updateAction(row.data, "defaultAction");
}} }}
aria-label={row.name} aria-label={row.name}
/> />

View File

@ -148,8 +148,8 @@ export const GenerateKeyDialog = ({
key="confirm" key="confirm"
data-testid="confirm" data-testid="confirm"
isDisabled={!isValid} isDisabled={!isValid}
onClick={() => { onClick={async () => {
handleSubmit((config) => { await handleSubmit((config) => {
save(config); save(config);
toggleDialog(); toggleDialog();
})(); })();

View File

@ -58,8 +58,8 @@ export const ImportKeyDialog = ({
id="modal-confirm" id="modal-confirm"
data-testid="confirm" data-testid="confirm"
key="confirm" key="confirm"
onClick={() => { onClick={async () => {
handleSubmit((importFile) => { await handleSubmit((importFile) => {
save(importFile); save(importFile);
toggleDialog(); toggleDialog();
})(); })();

View File

@ -32,8 +32,8 @@ export const SamlImportKeyDialog = ({
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
const submit = (form: SamlKeysDialogForm) => { const submit = async (form: SamlKeysDialogForm) => {
submitForm(adminClient, form, id, attr, (error) => { await submitForm(adminClient, form, id, attr, (error) => {
if (error) { if (error) {
addError("importError", error); addError("importError", error);
} else { } else {
@ -50,8 +50,8 @@ export const SamlImportKeyDialog = ({
continueButtonLabel="import" continueButtonLabel="import"
titleKey="importKey" titleKey="importKey"
confirmButtonDisabled={!isValid} confirmButtonDisabled={!isValid}
onConfirm={() => { onConfirm={async () => {
handleSubmit(submit)(); await handleSubmit(submit)();
}} }}
> >
<FormProvider {...form}> <FormProvider {...form}>

View File

@ -224,8 +224,8 @@ export const SamlKeys = ({ clientId, save }: SamlKeysProps) => {
messageKey: "reGenerateSigningExplain", messageKey: "reGenerateSigningExplain",
continueButtonLabel: "yes", continueButtonLabel: "yes",
cancelButtonLabel: "no", cancelButtonLabel: "no",
onConfirm: () => { onConfirm: async () => {
generate(selectedType!); await generate(selectedType!);
}, },
}); });

View File

@ -84,8 +84,8 @@ export const SamlKeysDialog = ({
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
const submit = (form: SamlKeysDialogForm) => { const submit = async (form: SamlKeysDialogForm) => {
submitForm(adminClient, form, id, attr, (error) => { await submitForm(adminClient, form, id, attr, (error) => {
if (error) { if (error) {
addError("importError", error); addError("importError", error);
} else { } else {
@ -133,9 +133,9 @@ export const SamlKeysDialog = ({
data-testid="confirm" data-testid="confirm"
variant="primary" variant="primary"
isDisabled={!isValid && !keys} isDisabled={!isValid && !keys}
onClick={() => { onClick={async () => {
if (type) { if (type) {
handleSubmit(submit)(); await handleSubmit(submit)();
} }
onClose(); onClose();
}} }}

View File

@ -34,7 +34,7 @@ export const RealmContextProvider = ({ children }: PropsWithChildren) => {
// Configure admin client to use selected realm when it changes. // Configure admin client to use selected realm when it changes.
useEffect(() => { useEffect(() => {
(async () => { void (async () => {
adminClient.setConfig({ realmName: realm }); adminClient.setConfig({ realmName: realm });
const namespace = encodeURIComponent(realm); const namespace = encodeURIComponent(realm);
await i18n.loadNamespaces(namespace); await i18n.loadNamespaces(namespace);

View File

@ -33,7 +33,7 @@ export class WhoAmI {
constructor(me?: WhoAmIRepresentation) { constructor(me?: WhoAmIRepresentation) {
this.#me = me; this.#me = me;
if (this.#me?.locale) { if (this.#me?.locale) {
i18n.changeLanguage(this.#me.locale, (error) => { void i18n.changeLanguage(this.#me.locale, (error) => {
if (error) { if (error) {
console.warn("Error(s) loading locale", this.#me?.locale, error); console.warn("Error(s) loading locale", this.#me?.locale, error);
} }

View File

@ -92,7 +92,7 @@ export const AssignedPolicies = ({
: [], : [],
); );
const assign = (policies: { policy: PolicyRepresentation }[]) => { const assign = async (policies: { policy: PolicyRepresentation }[]) => {
const assignedPolicies = policies.map(({ policy }) => ({ const assignedPolicies = policies.map(({ policy }) => ({
id: policy.id!, id: policy.id!,
})); }));
@ -101,7 +101,7 @@ export const AssignedPolicies = ({
...(getValues("policies") || []), ...(getValues("policies") || []),
...assignedPolicies, ...assignedPolicies,
]); ]);
trigger("policies"); await trigger("policies");
setSelectedPolicies([ setSelectedPolicies([
...selectedPolicies, ...selectedPolicies,
...policies.map(({ policy }) => policy), ...policies.map(({ policy }) => policy),
@ -171,8 +171,8 @@ export const AssignedPolicies = ({
providers={providers!} providers={providers!}
policies={policies!} policies={policies!}
resourceType={resourceType} resourceType={resourceType}
onAssign={(newPolicy) => { onAssign={async (newPolicy) => {
assign([{ policy: newPolicy }]); await assign([{ policy: newPolicy }]);
}} }}
/> />
)} )}

View File

@ -179,9 +179,9 @@ export const NewPermissionPolicyDialog = ({
> >
<Form <Form
id="createPermissionPolicy-form" id="createPermissionPolicy-form"
onSubmit={(e) => { onSubmit={async (e) => {
e.stopPropagation(); e.stopPropagation();
handleSubmit(save)(e); await handleSubmit(save)(e);
}} }}
isHorizontal isHorizontal
> >

View File

@ -128,8 +128,8 @@ export const DefaultsGroupsTab = () => {
title: "addDefaultGroups", title: "addDefaultGroups",
ok: "add", ok: "add",
}} }}
onConfirm={(groups) => { onConfirm={async (groups) => {
addGroups(groups || []); await addGroups(groups || []);
toggleGroupPicker(); toggleGroupPicker();
}} }}
onClose={toggleGroupPicker} onClose={toggleGroupPicker}

View File

@ -71,8 +71,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.registrationAllowed} isChecked={realm.registrationAllowed}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue({ registrationAllowed: value }); await updateSwitchValue({ registrationAllowed: value });
}} }}
aria-label={t("registrationAllowed")} aria-label={t("registrationAllowed")}
/> />
@ -96,8 +96,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.resetPasswordAllowed} isChecked={realm.resetPasswordAllowed}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue({ resetPasswordAllowed: value }); await updateSwitchValue({ resetPasswordAllowed: value });
}} }}
aria-label={t("resetPasswordAllowed")} aria-label={t("resetPasswordAllowed")}
/> />
@ -120,8 +120,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.rememberMe} isChecked={realm.rememberMe}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue({ rememberMe: value }); await updateSwitchValue({ rememberMe: value });
}} }}
aria-label={t("rememberMe")} aria-label={t("rememberMe")}
/> />
@ -148,8 +148,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.registrationEmailAsUsername} isChecked={realm.registrationEmailAsUsername}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue([ await updateSwitchValue([
{ {
registrationEmailAsUsername: value, registrationEmailAsUsername: value,
}, },
@ -179,8 +179,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.loginWithEmailAllowed} isChecked={realm.loginWithEmailAllowed}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue([ await updateSwitchValue([
{ {
loginWithEmailAllowed: value, loginWithEmailAllowed: value,
}, },
@ -207,8 +207,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.duplicateEmailsAllowed} isChecked={realm.duplicateEmailsAllowed}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue({ await updateSwitchValue({
duplicateEmailsAllowed: value, duplicateEmailsAllowed: value,
}); });
}} }}
@ -237,8 +237,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.verifyEmail} isChecked={realm.verifyEmail}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue({ verifyEmail: value }); await updateSwitchValue({ verifyEmail: value });
}} }}
aria-label={t("verifyEmail")} aria-label={t("verifyEmail")}
/> />
@ -268,8 +268,8 @@ export const RealmSettingsLoginTab = ({
label={t("on")} label={t("on")}
labelOff={t("off")} labelOff={t("off")}
isChecked={realm.editUsernameAllowed} isChecked={realm.editUsernameAllowed}
onChange={(_event, value) => { onChange={async (_event, value) => {
updateSwitchValue({ editUsernameAllowed: value }); await updateSwitchValue({ editUsernameAllowed: value });
}} }}
aria-label={t("editUsernameAllowed")} aria-label={t("editUsernameAllowed")}
/> />

View File

@ -386,9 +386,9 @@ export default function NewClientPolicy() {
titleKey: "disablePolicyConfirmTitle", titleKey: "disablePolicyConfirmTitle",
messageKey: "disablePolicyConfirm", messageKey: "disablePolicyConfirm",
continueButtonLabel: "disable", continueButtonLabel: "disable",
onConfirm: () => { onConfirm: async () => {
form.setValue("enabled", !form.getValues().enabled); form.setValue("enabled", !form.getValues().enabled);
save(); await save();
}, },
}); });
@ -401,8 +401,8 @@ export default function NewClientPolicy() {
<DeleteConditionConfirm /> <DeleteConditionConfirm />
<DeleteProfileConfirm /> <DeleteProfileConfirm />
<AddClientProfileModal <AddClientProfileModal
onConfirm={(profiles: ClientProfileRepresentation[]) => { onConfirm={async (profiles: ClientProfileRepresentation[]) => {
addProfiles(profiles.map((item) => item.name!)); await addProfiles(profiles.map((item) => item.name!));
}} }}
allProfiles={policyProfiles} allProfiles={policyProfiles}
open={profilesModalOpen} open={profilesModalOpen}
@ -452,12 +452,12 @@ export default function NewClientPolicy() {
} }
isReadOnly={isGlobalPolicy} isReadOnly={isGlobalPolicy}
isEnabled={field.value} isEnabled={field.value}
onToggle={(value) => { onToggle={async (value) => {
if (!value) { if (!value) {
toggleDisableDialog(); toggleDisableDialog();
} else { } else {
field.onChange(value); field.onChange(value);
save(); await save();
} }
}} }}
/> />

View File

@ -287,8 +287,8 @@ export const PartialImportDialog = (props: PartialImportProps) => {
data-testid="confirm" data-testid="confirm"
key="import" key="import"
isDisabled={!isAnyResourceChecked} isDisabled={!isAnyResourceChecked}
onClick={() => { onClick={async () => {
doImport(); await doImport();
}} }}
> >
{t("import")} {t("import")}

View File

@ -272,9 +272,9 @@ export const PoliciesTab = () => {
clientPolicy={clientPolicy} clientPolicy={clientPolicy}
form={form} form={form}
saveStatus={saveStatus} saveStatus={saveStatus}
onConfirm={() => { onConfirm={async () => {
form.setValue(clientPolicy.name!, false); form.setValue(clientPolicy.name!, false);
saveStatus(); await saveStatus();
}} }}
/> />
), ),

View File

@ -218,7 +218,7 @@ export const RealmSettingsTabs = () => {
return []; return [];
} }
}; };
fetchLocalizationTexts(); void fetchLocalizationTexts();
}, [setValue, realm]); }, [setValue, realm]);
const save = async (r: UIRealmRepresentation) => { const save = async (r: UIRealmRepresentation) => {

View File

@ -154,7 +154,7 @@ export const EventsTab = ({ realm }: EventsTabProps) => {
const enabledEventTypes = events?.enabledEventTypes?.filter( const enabledEventTypes = events?.enabledEventTypes?.filter(
(e) => !values.includes(e), (e) => !values.includes(e),
); );
addEvents(enabledEventTypes); await addEvents(enabledEventTypes);
setEvents({ ...events, enabledEventTypes }); setEvents({ ...events, enabledEventTypes });
}; };

View File

@ -147,7 +147,7 @@ export const RealmOverrides = ({
} }
}; };
fetchLocalizationTexts().then((translations) => { void fetchLocalizationTexts().then((translations) => {
const updatedRows: IRow[] = translations.map( const updatedRows: IRow[] = translations.map(
(translation): IRow => ({ (translation): IRow => ({
rowEditBtnAriaLabel: () => rowEditBtnAriaLabel: () =>
@ -221,7 +221,7 @@ export const RealmOverrides = ({
refreshTable(); refreshTable();
translationForm.setValue("key", ""); translationForm.setValue("key", "");
translationForm.setValue("value", ""); translationForm.setValue("value", "");
i18n.reloadResources(); await i18n.reloadResources();
addAlert(t("addTranslationSuccess"), AlertVariant.success); addAlert(t("addTranslationSuccess"), AlertVariant.success);
} catch (error) { } catch (error) {
@ -321,7 +321,7 @@ export const RealmOverrides = ({
}, },
value, value,
); );
i18n.reloadResources(); await i18n.reloadResources();
addAlert(t("updateTranslationSuccess"), AlertVariant.success); addAlert(t("updateTranslationSuccess"), AlertVariant.success);
setTableRows(newRows); setTableRows(newRows);
@ -341,8 +341,8 @@ export const RealmOverrides = ({
{addTranslationModalOpen && ( {addTranslationModalOpen && (
<AddTranslationModal <AddTranslationModal
handleModalToggle={handleModalToggle} handleModalToggle={handleModalToggle}
save={(pair: any) => { save={async (pair: any) => {
addKeyValue(pair); await addKeyValue(pair);
handleModalToggle(); handleModalToggle();
}} }}
form={translationForm} form={translationForm}
@ -517,8 +517,8 @@ export const RealmOverrides = ({
<Form <Form
isHorizontal isHorizontal
className="kc-form-translationValue" className="kc-form-translationValue"
onSubmit={handleSubmit(() => { onSubmit={handleSubmit(async () => {
onSubmit(formValue, rowIndex); await onSubmit(formValue, rowIndex);
})} })}
> >
<FormGroup <FormGroup

View File

@ -25,7 +25,7 @@ export const ImageUpload = ({ name, onChange }: ImageUploadProps) => {
}); });
if (file) { if (file) {
fileToDataUri(file).then((dataUri) => { void fileToDataUri(file).then((dataUri) => {
setDataUri(dataUri); setDataUri(dataUri);
onChange?.(dataUri); onChange?.(dataUri);
}); });
@ -35,7 +35,7 @@ export const ImageUpload = ({ name, onChange }: ImageUploadProps) => {
useEffect(() => { useEffect(() => {
(() => { (() => {
if (loadedFile) { if (loadedFile) {
fileToDataUri(loadedFile).then((dataUri) => { void fileToDataUri(loadedFile).then((dataUri) => {
setDataUri(dataUri); setDataUri(dataUri);
}); });
} }

View File

@ -144,8 +144,8 @@ export const ThemeColors = ({ realm, save, theme }: ThemeColorsProps) => {
<> <>
{open && ( {open && (
<FileNameDialog <FileNameDialog
onSave={(name) => { onSave={async (name) => {
handleSubmit((data) => convert({ ...data, name }))(); await handleSubmit((data) => convert({ ...data, name }))();
setOpen(false); setOpen(false);
}} }}
onClose={toggle} onClose={toggle}

View File

@ -134,7 +134,7 @@ styles=css/login.css css/theme-styles.css
} }
`, `,
); );
zip.generateAsync({ type: "blob" }).then((content) => { await zip.generateAsync({ type: "blob" }).then((content) => {
const url = URL.createObjectURL(content); const url = URL.createObjectURL(content);
const a = document.createElement("a"); const a = document.createElement("a");
a.href = url; a.href = url;

View File

@ -104,7 +104,7 @@ export const AttributesGroupTab = ({
}), }),
); );
save( await save(
{ ...config, groups }, { ...config, groups },
{ {
successMessageKey: "deleteSuccess", successMessageKey: "deleteSuccess",

View File

@ -102,7 +102,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
(attribute) => attribute.name !== attributeToDelete, (attribute) => attribute.name !== attributeToDelete,
); );
save( await save(
{ ...config, attributes: updatedAttributes, groups: config.groups }, { ...config, attributes: updatedAttributes, groups: config.groups },
{ {
successMessageKey: "deleteAttributeSuccess", successMessageKey: "deleteAttributeSuccess",
@ -139,7 +139,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
attributes.splice(fromIndex, 1); attributes.splice(fromIndex, 1);
attributes.splice(newIndex, 0, movedAttribute); attributes.splice(newIndex, 0, movedAttribute);
save( await save(
{ attributes, groups }, { attributes, groups },
{ {
successMessageKey: "updatedUserProfileSuccess", successMessageKey: "updatedUserProfileSuccess",
@ -228,7 +228,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
const dragged = attributes[oldIndex]; const dragged = attributes[oldIndex];
if (!dragged.name) return; if (!dragged.name) return;
executeMove(dragged, newIndex); await executeMove(dragged, newIndex);
}} }}
actions={[ actions={[
{ {

View File

@ -114,8 +114,8 @@ export const RevocationModal = ({
data-testid="set-to-now-button" data-testid="set-to-now-button"
key="set-to-now" key="set-to-now"
variant="tertiary" variant="tertiary"
onClick={() => { onClick={async () => {
setToNow(); await setToNow();
handleModalToggle(); handleModalToggle();
}} }}
form="revocation-modal-form" form="revocation-modal-form"
@ -126,8 +126,8 @@ export const RevocationModal = ({
data-testid="clear-not-before-button" data-testid="clear-not-before-button"
key="clear" key="clear"
variant="tertiary" variant="tertiary"
onClick={() => { onClick={async () => {
clearNotBefore(); await clearNotBefore();
handleModalToggle(); handleModalToggle();
}} }}
form="revocation-modal-form" form="revocation-modal-form"
@ -138,8 +138,8 @@ export const RevocationModal = ({
data-testid="modal-test-connection-button" data-testid="modal-test-connection-button"
key="push" key="push"
variant="secondary" variant="secondary"
onClick={() => { onClick={async () => {
push(); await push();
handleModalToggle(); handleModalToggle();
}} }}
form="revocation-modal-form" form="revocation-modal-form"

View File

@ -208,8 +208,8 @@ export default function LdapMapperDetails() {
? [ ? [
<DropdownItem <DropdownItem
key="ldapSync" key="ldapSync"
onClick={() => { onClick={async () => {
sync("keycloakToFed"); await sync("keycloakToFed");
}} }}
> >
{t(mapper.metadata.keycloakToFedSyncMessage)} {t(mapper.metadata.keycloakToFedSyncMessage)}

View File

@ -230,8 +230,8 @@ export default function EditUser() {
titleKey: "disableConfirmUserTitle", titleKey: "disableConfirmUserTitle",
messageKey: "disableConfirmUser", messageKey: "disableConfirmUser",
continueButtonLabel: "disable", continueButtonLabel: "disable",
onConfirm: () => { onConfirm: async () => {
save({ await save({
...toUserFormFields(user!), ...toUserFormFields(user!),
enabled: false, enabled: false,
}); });
@ -326,11 +326,11 @@ export default function EditUser() {
{t("delete")} {t("delete")}
</DropdownItem>, </DropdownItem>,
]} ]}
onToggle={(value) => { onToggle={async (value) => {
if (!value) { if (!value) {
toggleDisableDialog(); toggleDisableDialog();
} else { } else {
save({ await save({
...toUserFormFields(user), ...toUserFormFields(user),
enabled: value, enabled: value,
}); });

View File

@ -263,9 +263,9 @@ export const UserCredentials = ({ user, setUser }: UserCredentialsProps) => {
); );
}; };
const onDrop = (evt: ReactDragEvent) => { const onDrop = async (evt: ReactDragEvent) => {
if (isValidDrop(evt)) { if (isValidDrop(evt)) {
onDragFinish(state.draggedItemId, state.tempItemOrder); await onDragFinish(state.draggedItemId, state.tempItemOrder);
} else { } else {
onDragCancel(); onDragCancel();
} }

View File

@ -168,11 +168,11 @@ export const UserForm = ({
ok: "join", ok: "join",
}} }}
canBrowse={isManager} canBrowse={isManager}
onConfirm={(groups) => { onConfirm={async (groups) => {
if (user?.id) { if (user?.id) {
addGroups(groups || []); await addGroups(groups || []);
} else { } else {
addChips(groups || []); await addChips(groups || []);
} }
setOpen(false); setOpen(false);
@ -305,8 +305,8 @@ export const UserForm = ({
<Switch <Switch
data-testid="user-locked-switch" data-testid="user-locked-switch"
id="temporaryLocked" id="temporaryLocked"
onChange={(_event, value) => { onChange={async (_event, value) => {
unLockUser(); await unLockUser();
setLocked(value); setLocked(value);
}} }}
isChecked={locked} isChecked={locked}

View File

@ -72,8 +72,8 @@ export const ResetCredentialDialog = ({
onCancel={onClose} onCancel={onClose}
toggleDialog={onClose} toggleDialog={onClose}
continueButtonLabel="credentialResetConfirm" continueButtonLabel="credentialResetConfirm"
onConfirm={() => { onConfirm={async () => {
handleSubmit(sendCredentialsResetEmail)(); await handleSubmit(sendCredentialsResetEmail)();
}} }}
confirmButtonDisabled={!resetIsNotDisabled} confirmButtonDisabled={!resetIsNotDisabled}
> >

View File

@ -157,8 +157,8 @@ export const ResetPasswordDialog = ({
<PasswordInput <PasswordInput
data-testid="passwordField" data-testid="passwordField"
id="password" id="password"
onChange={(e) => { onChange={async (e) => {
onChange(e); await onChange(e);
if (passwordConfirmation !== e.currentTarget.value) { if (passwordConfirmation !== e.currentTarget.value) {
setError("passwordConfirmation", { setError("passwordConfirmation", {
message: t("confirmPasswordDoesNotMatch").toString(), message: t("confirmPasswordDoesNotMatch").toString(),

View File

@ -26,7 +26,7 @@ export default function useQueryPermission(
setStatus(null); setStatus(null);
setPlainStatus(null); setPlainStatus(null);
navigator.permissions.query({ name }).then((newStatus) => { void navigator.permissions.query({ name }).then((newStatus) => {
setStatus(newStatus); setStatus(newStatus);
updatePlainStatus(newStatus); updatePlainStatus(newStatus);
}); });

View File

@ -90,14 +90,14 @@ async function assertElementExists(
} }
export async function assertJwksUrlExists(page: Page, exist: boolean = true) { export async function assertJwksUrlExists(page: Page, exist: boolean = true) {
assertElementExists(page, "[data-testid='config.jwksUrl']", exist); await assertElementExists(page, "[data-testid='config.jwksUrl']", exist);
} }
export async function assertPkceMethodExists( export async function assertPkceMethodExists(
page: Page, page: Page,
exist: boolean = true, exist: boolean = true,
) { ) {
assertElementExists(page, "#config\\.pkceMethod", exist); await assertElementExists(page, "#config\\.pkceMethod", exist);
} }
export async function goToMappersTab(page: Page) { export async function goToMappersTab(page: Page) {

View File

@ -11,7 +11,7 @@ export async function assertRowHasSignOutKebab(page: Page, row: string) {
} }
export async function clickNotBefore(page: Page) { export async function clickNotBefore(page: Page) {
page.getByTestId("clear-not-before-button").click(); await page.getByTestId("clear-not-before-button").click();
} }
export async function assertNotBeforeValue(page: Page, value: string) { export async function assertNotBeforeValue(page: Page, value: string) {

View File

@ -9,7 +9,7 @@ export async function clickSaveButton(page: Page) {
} }
export async function clickAddUserButton(page: Page) { export async function clickAddUserButton(page: Page) {
page.getByTestId("no-users-found-empty-action").click(); await page.getByTestId("no-users-found-empty-action").click();
} }
export async function fillUserForm( export async function fillUserForm(

View File

@ -14,7 +14,7 @@ export async function goToRealms(page: Page) {
} }
export async function goToOrganizations(page: Page) { export async function goToOrganizations(page: Page) {
page.getByTestId("nav-item-organizations").click(); await page.getByTestId("nav-item-organizations").click();
} }
export async function goToClients(page: Page) { export async function goToClients(page: Page) {

View File

@ -66,7 +66,6 @@ export default tseslint.config(
"@typescript-eslint/no-dynamic-delete": "off", "@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "off", "@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-invalid-void-type": "off", "@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/no-misused-promises": "off", "@typescript-eslint/no-misused-promises": "off",

View File

@ -158,7 +158,7 @@ describe("Realms", () => {
}); });
after(async () => { after(async () => {
deleteRealm(kcAdminClient, currentRealmName); await deleteRealm(kcAdminClient, currentRealmName);
}); });
it("list client initial access", async () => { it("list client initial access", async () => {
@ -211,7 +211,7 @@ describe("Realms", () => {
}); });
after(async () => { after(async () => {
deleteRealm(kcAdminClient, currentRealmName); await deleteRealm(kcAdminClient, currentRealmName);
}); });
it("add group to default groups", async () => { it("add group to default groups", async () => {
@ -321,7 +321,7 @@ describe("Realms", () => {
}); });
after(async () => { after(async () => {
deleteRealm(kcAdminClient, currentRealmName); await deleteRealm(kcAdminClient, currentRealmName);
}); });
}); });
@ -360,7 +360,7 @@ describe("Realms", () => {
}); });
after(async () => { after(async () => {
deleteRealm(kcAdminClient, currentRealmName); await deleteRealm(kcAdminClient, currentRealmName);
}); });
}); });
@ -396,7 +396,7 @@ describe("Realms", () => {
}); });
after(async () => { after(async () => {
deleteRealm(kcAdminClient, currentRealmName); await deleteRealm(kcAdminClient, currentRealmName);
}); });
}); });