You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But after starting to use HashRouter, quicklink has stopped working. So I debugged this issue from Quicklink source.
As you can see on the above screenshot, with HashRouter, the router link renders to an anchor tag with hash in its href attribute.
Looking at the implementation in Quicklink project.
The second argument of rmanifest method is entry.pathname, which does not return the hash href value of the link.
So I tried with entry.getAttribute("href") as the second argument of rmanifest method but this time it looked like rmanifest method does not understand the hash URI.
So I'm afraid quicklink 2.0 is not going with HashRouter.
I found a quick-fix solution to it without touching route-manifest logic for now but I'm not sure if this should be fixed within quicklink logic or that of route-manifest.
Set up the React app's route manifest without # in webpack-route-manifest configuration so that we can get route URLs without # prefixed from the window.__rmanifest.
But I'm concerned that developers might come to add # by just referring to the URL from the address bar of the browser.
Make some change to quicklink (removing # from the detected link's href) in order to match to the URLs from window.__rmanifest setup in step 1.
Then we could make quicklink work with HashRouter anyhow. But to be honest, it looks manual and hard-coded.
Could you please review and tell me if this should be fixed within quicklink or route-manifest?
Thank you.
Hi @lukeed
Could you please have a look at this issue and give us advice? Thank you.
The other day, I integrated
quicklink 2.0
with one React project. It was working very well.They used BrowserRouter at first but turned to using HashRouter for some reason. For example, the reason for using
HashRouter
is https://stackoverflow.com/questions/27928372/react-router-urls-dont-work-when-refreshing-or-writing-manually/36623117#36623117But after starting to use
HashRouter
,quicklink
has stopped working. So I debugged this issue from Quicklink source.As you can see on the above screenshot, with
HashRouter
, the router link renders to an anchor tag with hash in its href attribute.Looking at the implementation in Quicklink project.
The second argument of rmanifest method is
entry.pathname
, which does not return the hash href value of the link.So I tried with
entry.getAttribute("href")
as the second argument ofrmanifest
method but this time it looked likermanifest
method does not understand the hash URI.So I'm afraid
quicklink 2.0
is not going withHashRouter
.I found a quick-fix solution to it without touching
route-manifest
logic for now but I'm not sure if this should be fixed withinquicklink
logic or that ofroute-manifest
.webpack-route-manifest
configuration so that we can get route URLs without # prefixed from thewindow.__rmanifest
.quicklink
(removing # from the detected link's href) in order to match to the URLs fromwindow.__rmanifest
setup in step 1.Then we could make
quicklink
work withHashRouter
anyhow. But to be honest, it looks manual and hard-coded.Could you please review and tell me if this should be fixed within
quicklink
orroute-manifest
?Thank you.
cc @addyosmani @demianrenzulli
The text was updated successfully, but these errors were encountered: