Closed tmheunis closed 8 months ago
Note to self about the functionality:
Home button calls router.push(params)
and when Vue Router realises that the user is trying to navigate to the same route that is currently active, it throws an error:
vue-router.3.5.3.min.js:11 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/dataset/e132ac40-30c5-457d-8c7c-0dcbdbb95d9a/2954f6f464927b1ffd37ea0af8c716abf40d273a".
at wt (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:16484)
at _t.confirmTransition (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:19437)
at _t.transitionTo (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:18762)
at e.push (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:23180)
at https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:26586
at new Promise (<anonymous>)
at Vt.push (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:26549)
at rawFile.onreadystatechange (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/app_router.js:19:20)
at beforeEnter (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/app_router.js:35:15)
at y (https://psychoinformatics-de.github.io/sfb1451-projects-catalog/assets/vue-router.3.5.3.min.js:11:20045)
wt @ vue-router.3.5.3.min.js:11
_t.confirmTransition @ vue-router.3.5.3.min.js:11
_t.transitionTo @ vue-router.3.5.3.min.js:11
e.push @ vue-router.3.5.3.min.js:11
(anonymous) @ vue-router.3.5.3.min.js:11
Vt.push @ vue-router.3.5.3.min.js:11
rawFile.onreadystatechange @ app_router.js:19
beforeEnter @ app_router.js:35
y @ vue-router.3.5.3.min.js:11
n @ vue-router.3.5.3.min.js:11
n @ vue-router.3.5.3.min.js:11
vt @ vue-router.3.5.3.min.js:11
_t.confirmTransition @ vue-router.3.5.3.min.js:11
_t.transitionTo @ vue-router.3.5.3.min.js:11
e.push @ vue-router.3.5.3.min.js:11
(anonymous) @ vue-router.3.5.3.min.js:11
Vt.push @ vue-router.3.5.3.min.js:11
gotoHome @ app_component_dataset.js:380
Be @ vue.2.6.14.min.js:6
n @ vue.2.6.14.min.js:6
Qr.o._wrapper @ vue.2.6.14.min.js:6
vue-router.3.5.3.min.js:11 Uncaught (in promise) Error: Navigation cancelled from "/dataset/e132ac40-30c5-457d-8c7c-0dcbdbb95d9a/2954f6f464927b1ffd37ea0af8c716abf40d273a" to "/" with a new navigation.
at wt (vue-router.3.5.3.min.js:11:16484)
at gt (vue-router.3.5.3.min.js:11:16348)
at y (vue-router.3.5.3.min.js:11:20032)
at n (vue-router.3.5.3.min.js:11:15936)
at vue-router.3.5.3.min.js:11:15955
at vue-router.3.5.3.min.js:11:20411
at rawFile.onreadystatechange (app_router.js:26:13)
at beforeEnter (app_router.js:35:15)
at y (vue-router.3.5.3.min.js:11:20045)
at n (vue-router.3.5.3.min.js:11:15936)
I think the code should catch this redundant navigation attempt and call the necessary functionality.
Also, any refactoring of routing code should take into account route.push()
and/or route.replace()
for tab navigation, see https://github.com/datalad/datalad-catalog/issues/391.
The current idea is to run some logic in the goToHome()
function on the dataset component, before navigation:
Current logic when pressing home button when located on any dataset page in a catalog:
If there is NO home page set:
If there IS a home page set:
reset = clear filters and set tab index = 0
If I filter subdatasets by any means, and then I select the home button I would expect to reset the filtering options to default. Also, if I click the home button I would expect it to reset to the subdatasets tab, if I were originally on funding or content tabs.