From cedbbc9bee43901804582bc7276955c2cd849869 Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Wed, 1 May 2024 14:42:13 +0200 Subject: [PATCH] (de)(pronouns) fix comprehensive switch on any rout --- routes/any.vue | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/routes/any.vue b/routes/any.vue index a48149b0e..6a7e9cc3f 100644 --- a/routes/any.vue +++ b/routes/any.vue @@ -7,7 +7,7 @@ pronouns.introquotation.colon - +
@@ -89,8 +89,6 @@ export default { exampleCategories: ExampleCategory.from(examples, this.$config), short, pronounGroups, - - comprehensive: false, }; }, head() { @@ -100,6 +98,24 @@ export default { }); }, computed: { + comprehensive: { + get() { + return Object.hasOwn(this.$route.query, this.$config.pronouns.comprehensive); + }, + set(value) { + if (value === this.comprehensive) { + // prevent warning that $router.replace has no effect + return; + } + const query = structuredClone(this.$route.query); + if (value) { + query[this.$config.pronouns.comprehensive] = null; + } else { + delete query[this.$config.pronouns.comprehensive]; + } + this.$router.replace({ query }); + }, + }, pronounsChoice() { if (!this.pronounGroups.length) { return Object.values(pronouns);