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

In Safari, routing to <GmapMap> creates unintended window.history.state #485

Closed
byeokim opened this issue Sep 11, 2018 · 5 comments
Closed

Comments

@byeokim
Copy link

byeokim commented Sep 11, 2018

In Safari (both macOS and iOS versions), routing to a route containing <GmapMap> component for the first time, it works as expected. However, routing to the route for the second time using Safari's Back/Forward buttons, it doesn't work as expected: it creates additional window.history.state.

Link to reproduction

https://jsfiddle.net/nuacb10j/
(if Google Maps JavaScript API key doesn't work, please try again with your own API key)

Steps to reproduce

At /,

  1. Click /foo
  2. Click Safari's Back button
  3. Click Safari's Forward button
  4. Click Safari's Back button

Expected behavior

Navigate to /

Actual behavior

Navigate to /foo (another /foo which was created after step 3)

Additional infomation

  • In the steps to reproduce, clicking /home instead of /foo works as expected. (/home doesn't contain <GmapMap> component)
  • In Chrome it works as expected.
@Rombusevil
Copy link

Did you find a workaround for this @byeokim ?

@byeokim
Copy link
Author

byeokim commented Jan 8, 2019

No, I couldn't. Are you experiencing the same issue, @Rombusevil?

@xkjyeah
Copy link
Owner

xkjyeah commented Jan 9, 2019

Have you tried wrapping your <router-view> inside a <keep-alive>?

i.e.

<keep-alive><router-view/></keep-alive>

@byeokim
Copy link
Author

byeokim commented Jan 9, 2019

It solved the issue. Thank you for your suggestion.

What about you, @Rombusevil ?

@xkjyeah xkjyeah closed this as completed Jan 26, 2019
@jiangtaste
Copy link

Have you tried wrapping your <router-view> inside a <keep-alive>?

i.e.

<keep-alive><router-view/></keep-alive>

It's works!

I even checked all docs about vue & vue-router, and created so much DEMO to debug this issue these days.
Thank u so much, you save me...

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

No branches or pull requests

4 participants