Skip to content
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

createBrowserHistory() breaks history URL on iOS 11 #964

Open
noradium opened this issue Nov 22, 2022 · 0 comments · May be fixed by #965
Open

createBrowserHistory() breaks history URL on iOS 11 #964

noradium opened this issue Nov 22, 2022 · 0 comments · May be fixed by #965

Comments

@noradium
Copy link

Hello,

I found the bug that createBrowserHistory() breaks URL in history on iOS 11 (or below) safari.

Steps to reproduce

(Suppose following path was on https://example.com)

  1. /pageA (not call createBrowserHistory)
  2. /pageB (from link in pageA / has <base href="https://example.com"> tag / call createBrowserHistory)
  3. /pageC (from link in pageB)
  4. Browser Back

Expected Behavior

back to /pageB

Actual Behavior

back to /

My Thought

This behavior is probably due to webkit bug. (Bug 182678: replaceState cause back/forward malfunction on html page with tag)

replaceState without 3rd argument at https://github.com/remix-run/history/blob/dev/packages/history/index.ts#L439 causes.

There is a workaround to pass current URL like this.

    globalHistory.replaceState({ ...globalHistory.state, idx: index }, "", createHref(location));

I confirmed that it fixed the issue.

May I make a PR?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant