-
Notifications
You must be signed in to change notification settings - Fork 959
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
Attempt to fix https://github.com/reactjs/react-router/issues/3241 #267
Conversation
@@ -39,7 +39,7 @@ function createBrowserHistory(options={}) { | |||
key = history.createKey() | |||
|
|||
if (isSupported) | |||
window.history.replaceState({ ...historyState, key }, null, path) | |||
window.history.replaceState({ ...historyState, key }, null, window.location.href) |
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.
The 3rd arg here should just be omitted, e.g.
window.history.replaceState({ ...historyState, key }, null)
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.
thanks yes I think it should work too, I'll try tomorow and edit my PR
…replaceState to let it unchanged See remix-run/react-router#3241
@taion I've tested and yes it seems to work fine for my usecase with your suggestion so I've updated the PR |
Just also want to point out that this code in useBasename.js:
It does not work to automatically solve my usecase so I have to configure manually the basename. Anyway not sure there's anything clever to be done here. Maybe history could automatically detect that basename has a different domain than current url and issue a meaningful error to tell the user to configure a basename? I tried Something like that might work: var base = document.getElementsByTagName('base')[0];
if (base ) {
// For most history/RR users
// base can be a relative path, or an absolute path of the same domain as the current page
if ( isLocationDomain(base) {
basename = _PathUtils.extractPath(base.href);
}
// For my usercase. Should not impact other users but make possible to solve my usecase without any configuration (with possibility to override if needed)
else {
basename = getLocationDomain();
}
} What do you think? I can make a new PR for that if you want. |
See the recent discussion on #94. The |
From #94 (comment) onward. |
@taion @mjackson @ryanflorence I've explained my issue more in-depth in remix-run/react-router#3241 (comment) Now I don't want to rush you guys but I have to put something in production in 8 days :) so I need to know if you will consider merging this fix and release 2.0.2 soon, or if I should consider publishing my own fork at least temporarily Thanks |
@slorber Would you mind adding a regression test here? The triggers for the bug are obscure enough that is a nontrivial risk of a regression later on without such a test. |
ok i'll try to check how this can be tested :) if you have ideas plz tell me |
Give me a sec. |
I added it: #274. |
great thanks :) |
No description provided.