I am trying to capture transitions to run a few checks before carrying on. In almost all of my use cases, I can accomplish it just fine.
However, I have one set of links that only change the queryParams
. When I try transition.abort()
on this link, I get an error.
Here is my template:
next
And, on the route:
actions: {
willTransition (transition) {
transition.abort();
}
}
The error:
transitionByIntent@https://192.168.1.3/assets/vendor.js:62857:16
refresh@https://192.168.1.3/assets/vendor.js:62948:14
refresh@https://192.168.1.3/assets/vendor.js:37404:14
queryParamsDidChange@https://192.168.1.3/assets/vendor.js:37123:13
triggerEvent@https://192.168.1.3/assets/vendor.js:39417:13
trigger@https://192.168.1.3/assets/vendor.js:64310:7
fireQueryParamDidChange@https://192.168.1.3/assets/vendor.js:63092:7
getTransitionByIntent@https://192.168.1.3/assets/vendor.js:62785:5
transitionByIntent@https://192.168.1.3/assets/vendor.js:62855:16
refresh@https://192.168.1.3/assets/vendor.js:62948:14
refresh@https://192.168.1.3/assets/vendor.js:37404:14
queryParamsDidChange@https://192.168.1.3/assets/vendor.js:37123:13
triggerEvent@https://192.168.1.3/assets/vendor.js:39417:13
trigger@https://192.168.1.3/assets/vendor.js:64310:7
fireQueryParamDidChange@https://192.168.1.3/assets/vendor.js:63092:7
getTransitionByIntent@https://192.168.1.3/assets/vendor.js:62785:5
I truncated the error message. Basically it looks like it is trying over and over and over again to make the transition.
Furthermore, despite the errors, the page does refresh (which it shouldn't) based upon the new parameters.
QUESTION
How to capture a transition on JUST a change in the query parameters, so that I can decide to proceed or abort
?
I know there is the queryParamsDidChange
hook. I wish there was queryParamsWillChange
.
Aucun commentaire:
Enregistrer un commentaire