[#4462] fixed Admin UI record and collection panels not reinitializing properly on browser back/forward navigation

This commit is contained in:
Gani Georgiev
2024-03-01 16:59:05 +02:00
parent 9babca5f77
commit bb410e7e0d
36 changed files with 124 additions and 92 deletions

View File

@@ -46,6 +46,7 @@
let activeTab = tabFormKey;
let isNew = true;
let isLoading = true;
let initialCollection = collection;
$: isAuthCollection = collection?.type === "auth";
@@ -66,6 +67,10 @@
updateDraft(serializedData);
}
$: if (collection && initialCollection?.id != collection?.id) {
onCollectionChange();
}
export function show(model) {
load(model);
@@ -85,6 +90,18 @@
hide();
}
function onCollectionChange() {
initialCollection = collection;
if (!recordPanel?.isActive()) {
return;
}
updateDraft(JSON.stringify(record));
forceHide();
}
async function resolveModel(model) {
if (model && typeof model === "string") {
// load from id