Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] fix: reset admin page save button in catch handler #3963

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion framework/core/js/src/admin/components/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,13 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt
app.alerts.show({ type: 'success' }, app.translator.trans('core.admin.settings.saved_message'));
}

/**
* Called when `saveSettings` completes with errors.
*/
onsavefailed(): void {
this.loading = false;
}

/**
* Returns a function that fetches the setting from the `app` global.
*/
Expand Down Expand Up @@ -394,6 +401,6 @@ export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAt

this.loading = true;

return saveSettings(this.dirty()).then(this.onsaved.bind(this));
return saveSettings(this.dirty()).then(this.onsaved.bind(this)).catch(this.onsavefailed.bind(this));
}
}