-
-
Notifications
You must be signed in to change notification settings - Fork 43
Fix issue 386 #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 386 #395
Changes from all commits
523c7fc
65dbddd
51b2798
6b352e9
2c3b6f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,20 @@ const componentDef = { | |
}, | ||
computed: Vuex.mapState({ | ||
asyncTemplate: state => state.pageTemplate, | ||
currentPathName: state => state.currentPathName, | ||
currentSearch: state => state.currentSearch, | ||
currentOrigin: state => state.currentOrigin, | ||
}), | ||
mounted: function(){ | ||
const self = this; | ||
window.onpopstate = (event) => { | ||
if (isNavigatingToAnotherPage(document.location, event)) { | ||
this.$store.dispatch("navigateTo", {url: document.location.pathname, backwards: true} ); | ||
}; | ||
if (isNavigatingToAnotherPage({ | ||
origin: self.currentOrigin, | ||
pathName: self.currentPathName, | ||
search: self.currentSearch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small thing, having all these "flat" in the store seemed weird to me before. This makes me feel it's even weirder. How about storing them in an object in the store? Like: |
||
}, document.location)){ | ||
self.$store.dispatch("navigateTo", {url: document.location.pathname, backwards: true} ); | ||
} | ||
} | ||
}, | ||
components: { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused that we'd need this. Yes, I read your comment it seems weird to me that there should be no way to access that state throughout the history/event API etc. 🤔
And I mean I also tried it out (not with the back button though obviously 😅 ) and there I had it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmkay, seems more involved. Odd, I guess I have to read up on the history APIs etc. https://stackoverflow.com/questions/8980255/how-do-i-retrieve-if-the-popstate-event-comes-from-back-or-forward-actions-with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried a lot, but this was the only way to fix it.