fix: Errore durante il caricamento di un record

This commit is contained in:
Maicol Battistini 2023-06-12 12:48:15 +02:00
parent 7e2c846199
commit 824c74c0ba
No known key found for this signature in database
1 changed files with 7 additions and 3 deletions

View File

@ -35,9 +35,13 @@ export default abstract class RecordPage<M extends Model<any, any>, A extends Re
}
async loadRecord(recordId?: number | string) {
if (recordId) {
const response = await this.modelQuery().find(recordId);
this.record = response.getData() || undefined;
if (recordId && recordId !== 'new' && !this.record) {
try {
const response = await this.modelQuery().find(recordId);
this.record = response.getData() || undefined;
} catch {
// Do nothing
}
}
if (!this.record) {