diff --git a/components/section.vue b/components/section.vue index 368da65c7..056d7ed4b 100644 --- a/components/section.vue +++ b/components/section.vue @@ -6,10 +6,13 @@ {{ label }} - {{ isCollapsed ? "expand_more" : "expand_less" }} + {{ isCollapsed(label) ? "expand_more" : "expand_less" }} -
+
@@ -26,15 +29,12 @@ export default { computed: { frameColorsEnabled() { return this.$store.state.postwoman.settings.FRAME_COLORS_ENABLED || false; + }, + sectionString() { + return `${this.$route.path}/${this.label}`; } }, - data() { - return { - isCollapsed: false - }; - }, - props: { label: { type: String, @@ -49,7 +49,15 @@ export default { collapse({ target }) { const parent = target.parentNode.parentNode; parent.querySelector(".collapsible").classList.toggle("hidden"); - this.isCollapsed = !this.isCollapsed; + // 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 a430d4ff0..465e5fbdb 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -6,12 +6,7 @@