Skip to content

Commit

Permalink
PageStatus: only load siblings when needed #2052
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Hoffmann committed Sep 14, 2019
1 parent e95f909 commit 081d223
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions panel/src/components/Dialogs/PageStatusDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,23 @@ export default {
details: page.errors
});
}
this.states = page.blueprint.status;
this.page = page;
this.states = page.blueprint.status;
this.form.status = page.status;
this.form.position = page.num || (page.siblings.length + 1);
this.$refs.dialog.open();
// only load siblings if needed
if (
page.status === "listed" &&
page.blueprint.num === "default"
) {
this.$api.pages.get(id, { select: ["siblings"] }).then(response => {
this.form.position = page.num || (response.siblings.length + 1);
this.$refs.dialog.open();
});
} else {
this.$refs.dialog.open();
}
})
.catch(error => {
this.$store.dispatch('notification/error', error);
Expand Down

0 comments on commit 081d223

Please sign in to comment.