reitit icon indicating copy to clipboard operation
reitit copied to clipboard

-href on FragmentHistory should include the path

Open dspiteself opened this issue 5 years ago • 3 comments

If the path is not included and you create a link it will always point to #/$path but your index file may not be root for instance /version/test/index.html#/$path

dspiteself avatar Feb 13 '20 23:02 dspiteself

What kind of problems did you encounter and where?

Existing behaviour should work in the most common case, where href return value is used for anchor href attribute:

<a href="#/items/2?foo=bar">Item 2</a>

This works because if anchor href starts with hash, browser will only update the location hash, and keep path and others intact.

You can test this with frontend example, and opening e.g.
http://localhost:3449/hello/world/, all the links still work because browser only changes the hash when clicking on the links.

Deraen avatar Mar 05 '20 12:03 Deraen

I guess the bug should be fixed in push-state When you call push-state with fragment-history It will not respect your existing path.

dspiteself avatar Mar 09 '20 14:03 dspiteself

I tested this locally on on examples/frontend, using the same url I mentioned in my previous comment. The index view contains buttons "item 3" and "replace state item 4" which call pushState and replaceState, and the both work correctly and keep the path intact and only update the fragment.

Deraen avatar Mar 24 '20 09:03 Deraen

The issue was resolved with recent updates to our link component. The problem was clearly not reitit.

dspiteself avatar May 09 '23 20:05 dspiteself