From 10711f904508fe2338c354637fd4ebd2e0abb4f0 Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 3 Mar 2019 12:15:55 -0500 Subject: [PATCH 1/3] #417: reset tab status when active user changes --- src/components/tab_switcher/tab_switcher.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 423df258..1de936e8 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -10,6 +10,11 @@ export default Vue.component('tab-switcher', { active: this.$slots.default.findIndex(_ => _.tag) } }, + watch: { + $route () { + this.activateTab(0) + } + }, methods: { activateTab (index) { return () => { From 3d30ad1dda8f31960586625bb6a432d6b3adde8e Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 3 Mar 2019 12:53:01 -0500 Subject: [PATCH 2/3] #417: refresh tab on user profile only --- src/components/tab_switcher/tab_switcher.js | 6 ++++-- src/components/user_profile/user_profile.vue | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 1de936e8..03da8249 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -4,7 +4,7 @@ import './tab_switcher.scss' export default Vue.component('tab-switcher', { name: 'TabSwitcher', - props: ['renderOnlyFocused'], + props: ['refresh', 'renderOnlyFocused'], data () { return { active: this.$slots.default.findIndex(_ => _.tag) @@ -12,7 +12,9 @@ export default Vue.component('tab-switcher', { }, watch: { $route () { - this.activateTab(0) + if (this.refresh) { + this.active = 0 + } } }, methods: { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index a3d2825f..54f1b97b 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -6,7 +6,7 @@ :switcher="true" :selected="timeline.viewing" /> - + Date: Sun, 3 Mar 2019 13:38:48 -0500 Subject: [PATCH 3/3] #417: reset tab from the outside --- src/components/tab_switcher/tab_switcher.js | 9 +-------- src/components/user_profile/user_profile.js | 3 +++ src/components/user_profile/user_profile.vue | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 03da8249..423df258 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -4,19 +4,12 @@ import './tab_switcher.scss' export default Vue.component('tab-switcher', { name: 'TabSwitcher', - props: ['refresh', 'renderOnlyFocused'], + props: ['renderOnlyFocused'], data () { return { active: this.$slots.default.findIndex(_ => _.tag) } }, - watch: { - $route () { - if (this.refresh) { - this.active = 0 - } - } - }, methods: { activateTab (index) { return () => { diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 7708141c..cdf1cee9 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -141,6 +141,9 @@ const UserProfile = { } this.cleanUp() this.startUp() + }, + $route () { + this.$refs.tabSwitcher.activateTab(0)() } }, components: { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 54f1b97b..8090efa5 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -6,7 +6,7 @@ :switcher="true" :selected="timeline.viewing" /> - +