always load the full record on record view

This commit is contained in:
Gani Georgiev
2024-11-13 19:35:07 +02:00
parent 9f606bdeca
commit 396aa0f97c
33 changed files with 96 additions and 94 deletions

View File

@@ -126,22 +126,24 @@
}
async function resolveModel(model) {
if (model && typeof model === "string") {
// load from id
try {
return await ApiClient.collection(collection.id).getOne(model);
} catch (err) {
if (!err.isAbort) {
forceHide();
console.warn("resolveModel:", err);
addErrorToast(`Unable to load record with id "${model}"`);
}
}
if (!model) {
return null;
}
return model;
let id = typeof model === "string" ? model : model?.id;
// load the full record
try {
return await ApiClient.collection(collection.id).getOne(id);
} catch (err) {
if (!err.isAbort) {
forceHide();
console.warn("resolveModel:", err);
addErrorToast(`Unable to load record with id "${id}"`);
}
}
return null;
}
async function load(model) {