mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-20 13:04:04 +02:00
reset fields id on collection duplicate
This commit is contained in:
1 parent
536707bfe7
commit
a27298d1ef
31 files changed
+71
-62
No files matched your search
@@ -53,6 +53,8 @@
|
||||
name: getUniqueFieldName(),
|
||||
});
|
||||
|
||||
field.onMountExpand = true;
|
||||
|
||||
collection.schema.push(field);
|
||||
collection.schema = collection.schema;
|
||||
}
|
||||
|
||||
@@ -209,6 +209,13 @@
|
||||
clone.created = "";
|
||||
clone.updated = "";
|
||||
clone.name += "_duplicate";
|
||||
|
||||
// reset the schema
|
||||
if (!CommonHelper.isEmpty(clone.schema)) {
|
||||
for (const field of clone.schema) {
|
||||
field.id = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
show(clone);
|
||||
|
||||
@@ -120,8 +120,8 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
// auto expand new fields
|
||||
if (!field.id) {
|
||||
if (field?.onMountExpand) {
|
||||
field.onMountExpand = false; // auto expand only the first time
|
||||
expand();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user