-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
feat: track map center and zoom in url, initial load map url params #1114
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@vnugent it looks like there is an issue with shallow routing in Next v13. I think it has been fixed in canary release, or maybe even a next v14 release. I used a more manual approach of using the It seems like we need to use Not very familiar with the routing in nextjs, so hopefully I am missing something! |
Correct. I haven't investigated whether there are breaking changes in Next 14. I did some research and came across this long discussion Can you see if |
@vnugent I pulled that library in and tested it a bit, but the behavior is the same. I am not sure if we need it. I checked some other websites and it seems our behavior matches. OSM has the same behavior where a back button click will reload the entire page at the new (previous) location. In addition, if we make this behavior work, it would prevent us from navigating away from the page with our back button. We'd have to click a the In addion, I have a different url format than OSM: https://www.openstreetmap.org/#map=5/38.007/-95.844 Do you think it would be better for me to switch to how OSM does it or keep as is? As you can see I am using URLSearchParams() to generate the url which I figure might be sufficient. |
I think it's perfectly fine using query string instead of the the # sign. Browsing history. Google and Bing maps have this behavior:
we're not supporting |
@vnugent sorry for leaving this for a while. i am not sure how google and bing is able to intercept the back button in order to prevent the refresh. we are able to detect the back button by listening to the 'popstate' event, but I cannot seem to prevent the page from refreshing. Regarding what you said about option 2. what do you mean? Do you want to not track the lat lng values unless the user has clicked on a poi? Also looks like my slowness resulted in another pr getting opened. if that solution is preferable this is fine to be closed. |
@clintonlunn I went ahead and merged (#1125). The back button is still a minor issue but we can live with it for now. Thanks for your work on this PR. |
@vnugent Glad it got sorted. I'll pick another issue and make sure to follow through with it. |
fixes #1113
name: Pull request
about: Create a pull request
title: ''
labels: ''
assignees: ''
What type of PR is this?(check all applicable)
Description
This pull request addresses #1113, where we want to create a shareable link that we can communicate zoom level and lat long center values.
In addition, added a skeleton to prevent the map from loading before the initial view state is available.
Related Issues
Issue #1113
What this PR achieves
Screenshots, recordings
Notes