Follow-up from "Fix creating permalink with shortcut key "y""
The following discussion from !150836 (merged) should be addressed:
-
@kpalchyk started a discussion: (+4 comments) And then I found another issue, which I haven't verified before. When the permalink button is hit twice — the back button navigation now throws a router error:
With the following console error:
I tested both on this branch and on master. Both issues are reproducible in both branches. So it's not related to current MR directly.
-
@markrian (!150836 (comment 1929623207)): The first one happens even if you don't click the permalink button. Just load the file tree in a fresh tab, click a file, click reload, and then hit back - the URL changes, but not the page content. I imagine this is because of how the Vue content replaces the DOM of the initial HAML view. That is, it's not a real navigation we're going back to, and we've not given the browser enough information about how to recover the original state. It's just lost.
The second one is interesting. I can recreate the error without a second click on the permalink:
- Navigate to file list
- Click a file
- Click the permalink button
- Click back
- Click forward
- Error
The error is thrown from
~/repository/router.js#L74.Here's a "good"
toobject followed by the one that causes the exception in this back/forward case:
And here it is in the double-permalink-click-then-back case:

I would guess the fix would be to use
router.push()rather thanupdateHistoryin the permalink/shortcut callback, but that gets a bit tricky to wire up.
NOTE: moveToFilePermalink() utility function that calls updateHistory is used both for a HAML view and Vue.js component.


