Fix Duplicate Hunt on Navigation to Hunt Page #682
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the Vue transition, I added a call to loadData at the end of initHunt because loading the page was not executing the default query and this change seemed to fix it. I didn't know it at the time, but it resulted in the first query when navigating to the hunt page being executed twice.
The actual root of the problem is that navigating to your exact, current route does not navigate. This results in $route not changing, which means the watch for it doesn't call loadData. This was discovered during the Vue transition but the fix was only applied to pushing a new state (hunt.js:367) and was not applied to when we replace the state. The same fix that was applied then has been applied more thoroughly and now there's only 1 hunt executed during page load.