2828
2929<script >
3030/* eslint-disable max-len */
31+ /* eslint-disable no-param-reassign */
3132
3233import HistoryRecommendations from ' @/components/app/recommendations/HistoryRecommendations.vue' ;
3334import DropdownDisplayChoiceHistory from ' @/components/shared/DropdownDisplayChoiceHistory.vue' ;
@@ -59,6 +60,7 @@ export default {
5960 recommendationsAnalysisDone: false ,
6061 filteredCount: null ,
6162 historyFetched: false ,
63+ visitUser: false ,
6264 }),
6365 methods: {
6466 async fetchUsers (request ) {
@@ -126,13 +128,14 @@ export default {
126128 this .recommendationsAnalysis .interests = [];
127129 this .recommendationsAnalysisDone = false ;
128130 this .historyFetched = false ;
131+ this .visitUser = false ;
129132 },
130- updateHistory (... args ) {
133+ async updateHistory (... args ) {
131134 const [key , value ] = args;
132135 if (key === ' history' ) {
133136 this .browseAgain ();
134- this .fetchUsers (value);
135- this .filteredCount = this .recommendations .count ;
137+ await this .fetchUsers (value);
138+ this .filteredCount = this .recommendations .length ;
136139 }
137140 },
138141 filteredCountSave (... args ) {
@@ -144,11 +147,23 @@ export default {
144147 await this .fetchUsers (' People I viewed' );
145148 this .filteredCount = this .recommendations .length ;
146149 },
150+ async beforeRouteEnter (to , from , next ) {
151+ next (async (vm ) => {
152+ if (from .name !== ' Users' || ! vm .visitUser ) {
153+ vm .browseAgain ();
154+ await vm .fetchUsers (' People I viewed' );
155+ vm .$el .scrollTop = 0 ;
156+ }
157+ vm .prevRoute = from;
158+ });
159+ },
147160 deactivated () {
148161 if (! this .$route .path .startsWith (' /users' )) {
149162 this .browseAgain ();
150163 this .fetchUsers (' People I viewed' );
151164 this .$el .scrollTop = 0 ;
165+ } else {
166+ this .visitUser = true ;
152167 }
153168 },
154169};
0 commit comments