feat: Ricarica i record alla chiusura di una DeleteDialog

This commit is contained in:
Maicol Battistini 2023-05-12 15:59:45 +02:00
parent aab28c8c56
commit 3d90a4eb41
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -56,7 +56,6 @@ export default class DeleteRecordDialog<M extends Model<any, any>, A extends Del
// TODO: Better way for pluralization in i18n // TODO: Better way for pluralization in i18n
void showSnackbar(this.records.length > 1 ? __('Record eliminati!') : __('Record eliminato!')); void showSnackbar(this.records.length > 1 ? __('Record eliminati!') : __('Record eliminato!'));
this.close('deleted'); this.close('deleted');
m.redraw();
} catch (error) { } catch (error) {
void showSnackbar(__('Errore durante l\'eliminazione del record! :error', {error: (error as RequestError<{message: string}>).response.message}), false); void showSnackbar(__('Errore durante l\'eliminazione del record! :error', {error: (error as RequestError<{message: string}>).response.message}), false);
} }

View File

@ -267,6 +267,13 @@ export default abstract class RecordsPage<M extends Model<any, any>, D extends A
if (!state) { if (!state) {
state = Stream<boolean>(); state = Stream<boolean>();
state.map((open) => {
if (!open) {
this.refreshRecords = true;
m.redraw();
}
return open;
});
this.deleteRecordsDialogStates.set(key, state); this.deleteRecordsDialogStates.set(key, state);
} }