-
Notifications
You must be signed in to change notification settings - Fork 961
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
Update createBrowserHistory.js #100
Conversation
This actually isn't going to work if someone just calls https://github.com/rackt/history/blob/v1.12.5/modules/createHashHistory.js#L39 |
@taion thanks for the hand holding...you guys clearly care about a gentle onboarding. much appreciated. |
invariant( | ||
canUseDOM, | ||
'Browser history needs a DOM' | ||
) | ||
|
||
let isSupported = supportsHistory() | ||
let { forceRefresh } = options |
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.
Indent here is inconsistent with the rest... should be 2 spaces rather than 3.
We should also document this somewhere. |
I just tried this out, and there's still a bug. When the location changes, it still fires all listeners immediately. That means that I see the page "glitch" immediately for a second, until the window reload occurs and actually navigates to the new URL. We need a way to tell history not to actually internally update its location if we are doing this. One way to do this is in if (ok) {
if(finishTransition(nextLocation) !== false) {
updateLocation(nextLocation);
}
} else if (location && nextLocation.action === _Actions.POP) {
...
} I just tried this and it works. |
@jlongster would you mind describing how you're manually testing. sorry if that sounds overly rudimentary. |
@pwmckenna I just modified the react-router code in my project manually. If you're talking about which projects, I'm testing it on my blog: https://github.com/jlongster/blog But it's probably not worth setting it up. Just try it on a simple project, and maybe delay the |
@jlongster IMO that's a separate bug though? Would the same issue not arise if the History API were actually unavailable? |
@taion That's true, yes it would have the same issue. Seems like we could still fix it in here though, unless you really want a separate PR? |
I think it might be slightly nicer since it's a separate atomic thing that's orthogonal to this. |
Ok done: #103. If accepted this should add |
I don't understand the test failure so I'm just blindly re-running the PR build. This looks good to me. |
LGTM. Not sure what our policy for merging stuff is so I'll let someone else hit the green button 😄 |
@jlongster Sorry what I meant was that the |
Update createBrowserHistory.js
Looks great. Thanks, @pwmckenna! |
add support for forceRefresh
addresses issue: #95