diff --git a/components/section.vue b/components/section.vue index 6556f1927..67f9fcb5e 100644 --- a/components/section.vue +++ b/components/section.vue @@ -3,10 +3,13 @@ {{ label }} - {{ isCollapsed ? "expand_more" : "expand_less" }} + {{ isCollapsed(label) ? "expand_more" : "expand_less" }} -
+
@@ -22,13 +25,10 @@ fieldset.no-colored-frames legend { export default { computed: { frameColorsEnabled() { - return this.$store.state.postwoman.settings.FRAME_COLORS_ENABLED || false + return this.$store.state.postwoman.settings.FRAME_COLORS_ENABLED || false; }, - }, - - data() { - return { - isCollapsed: false, + sectionString() { + return `${this.$route.path}/${this.label}`; } }, @@ -44,10 +44,18 @@ export default { methods: { collapse({ target }) { - const parent = target.parentNode.parentNode - parent.querySelector(".collapsible").classList.toggle("hidden") - this.isCollapsed = !this.isCollapsed + const parent = target.parentNode.parentNode; + parent.querySelector(".collapsible").classList.toggle("hidden"); + // Save collapsed section to local state + this.$store.commit("setCollapsedSection", this.sectionString); }, - }, -} + isCollapsed(label) { + return ( + this.$store.state.theme.collapsedSections.includes( + this.sectionString + ) || false + ); + } + } +}; diff --git a/pages/graphql.vue b/pages/graphql.vue index 5f8307704..465e5fbdb 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -144,10 +144,10 @@ -
+
-