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

The map still adds the hash after calling map.remove() #4375

Closed
petr-hajek opened this issue Jul 8, 2024 · 1 comment · Fixed by #4427
Closed

The map still adds the hash after calling map.remove() #4375

petr-hajek opened this issue Jul 8, 2024 · 1 comment · Fixed by #4427
Labels
bug Something isn't working good first issue Good for newcomers PR is more than welcomed Extra attention is needed

Comments

@petr-hajek
Copy link

petr-hajek commented Jul 8, 2024

maplibre-gl-js version: 4.5.0

browser: Chrome / any

Steps to Trigger Behavior

  1. Use the map with hash:true in Next.js
  2. Click on Next.js <Link> which triggers client side navigation (possibly it could happen with other React frameworks)
  3. Map is removed by calling map.remove() in the cleanup of the useEffect which initializes the map
  4. It navigates to the new page but it receives the map's hash

Link to Demonstration

codesandbox

Expected Behavior

After calling map.remove() it does not add the hash anymore

Actual Behavior

It adds the hash to the page it navigated to even though the map has been removed.

@HarelM HarelM added bug Something isn't working PR is more than welcomed Extra attention is needed good first issue Good for newcomers labels Jul 8, 2024
@HarelM
Copy link
Collaborator

HarelM commented Jul 8, 2024

Thanks for taking the time to open this issue!
Feel free to submit a fix, it should be fairly straight forward I think.

smellman added a commit to smellman/maplibre-gl-js-1 that referenced this issue Jul 18, 2024
smellman added a commit to smellman/maplibre-gl-js-1 that referenced this issue Jul 18, 2024
smellman added a commit to smellman/maplibre-gl-js-1 that referenced this issue Jul 18, 2024
smellman added a commit to smellman/maplibre-gl-js-1 that referenced this issue Jul 18, 2024
smellman added a commit to smellman/maplibre-gl-js-1 that referenced this issue Jul 18, 2024
HarelM pushed a commit that referenced this issue Jul 19, 2024
* #4375 remove hash string when hash remove

* #4375 update CHANGELOG

* #4375 fixes logics and added test cases

* #4375 remove IE11 related codes

* #4375 fixes lint errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers PR is more than welcomed Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants