[#4462] fixed Admin UI record and collection panels not reinitializing properly on browser back/forward navigation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user