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

[Bug]Cannot remove a WebglOverlay #354

Closed
AdamZajler opened this issue May 10, 2024 · 3 comments
Closed

[Bug]Cannot remove a WebglOverlay #354

AdamZajler opened this issue May 10, 2024 · 3 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@AdamZajler
Copy link

AdamZajler commented May 10, 2024

Description

When I'm changing places list that is passed down to the Map as a array for map of MapMarker i'm getting error

Cannot remove a WebglOverlay that has not been set to a map

image

Code that I'm using is the same as it was in: #325 (comment). Im just changing places, so it is triggering re-render of Map.

I'm also doing some calculations to center the map when places are changed or map is loaded:

const handleSetBounds = (): void => {
  if (!map) return;

  map.fitBounds(getMapBounds(window.google.maps, places));

  if (places.length < 2 && places.length > 0) {
    map.fitBounds(getMapBounds(window.google.maps, places));
    map.setZoom(14);
  } else if (places.length === 0) {
    map.setZoom(0);
    map.fitBounds(polandBounds);
  }
};

useEffect(() => {
  if (!map) return;
  handleSetBounds();

  // eslint-disable-next-line react-hooks/exhaustive-deps
}, [map, places]);

Steps to Reproduce

Change variable that is used to map thought map markers

Environment

  • Library version: "@vis.gl/react-google-maps": "^0.10.0",
  • Google maps version: weekly
  • Browser and Version: 124.0.6367.118
  • OS: Linux

Logs

Cannot remove a WebglOverlay that has not been set to a map 
    at eval (webpack-internal:///./node_modules/@vis.gl/react-google-maps/dist/index.modern.mjs:1081:5)
    at GoogleMapsMarker (webpack-internal:///./ui/google-maps/GoogleMapsMarker.tsx:23:11)
    at div
    at Map (webpack-internal:///./node_modules/@vis.gl/react-google-maps/dist/index.modern.mjs:783:5)
    at div
    at eval (webpack-internal:///./node_modules/@emotion/react/dist/emotion-element-43c6fea0.browser.esm.js:60:66)
    at Box (webpack-internal:///./node_modules/@mui/system/esm/createBox.js:37:72)
    at eval (webpack-internal:///./node_modules/@emotion/react/dist/emotion-element-43c6fea0.browser.esm.js:60:66)
overrideMethod @ console.js:273
a @ js?key=XXX&solution_channel=GMP_VISGL_react&loading=async&callback=__googleMapsCallback__:348
_.kn.map_changed @ js?key=XXX&solution_channel=GMP_VISGL_react&loading=async&callback=__googleMapsCallback__:348
Uk @ js?key=XXX&solution_channel=GMP_VISGL_react&loading=async&callback=__googleMapsCallback__:155
_.Sk.set @ js?key=XXX&solution_channel=GMP_VISGL_react&loading=async&callback=__googleMapsCallback__:274
(anonymous) @ js?key=XXX&solution_channel=GMP_VISGL_react&loading=async&callback=__googleMapsCallback__:163
dispose @ marker.js:103
KMa @ marker.js:60
dispose @ marker.js:129
setMap @ marker.js:122
set map @ marker.js:121
eval @ index.modern.mjs:1012
safelyCallDestroy @ react-dom.development.js:22932
commitHookEffectListUnmount @ react-dom.development.js:23100
commitPassiveUnmountInsideDeletedTreeOnFiber @ react-dom.development.js:25098
commitPassiveUnmountEffectsInsideOfDeletedTree_begin @ react-dom.development.js:25048
commitPassiveUnmountEffects_begin @ react-dom.development.js:24956
commitPassiveUnmountEffects @ react-dom.development.js:24941
flushPassiveEffectsImpl @ react-dom.development.js:27038
flushPassiveEffects @ react-dom.development.js:26984
commitRootImpl @ react-dom.development.js:26935
commitRoot @ react-dom.development.js:26682
performSyncWorkOnRoot @ react-dom.development.js:26117
flushSyncCallbacks @ react-dom.development.js:12042
eval @ react-dom.development.js:25651
Show 1 more frame
Show less
@AdamZajler AdamZajler added the bug Something isn't working label May 10, 2024
@xcong4328
Copy link

@usefulthink usefulthink added the duplicate This issue or pull request already exists label Jul 30, 2024
@usefulthink
Copy link
Collaborator

Closing this since it's a duplicate of #419.

We are aware this is happening occasionally, and it's clearly related to unmounting an AdvancedMarker component. It's also clear that it's "just" a warning message (annoying, true, but I haven't yet seen any consequence besides that warning in the console).

I already spent considerable time trying to figure out why exactly this is happening so we know how to prevent it.
Without a clear example that reliably reproduces this, it's quite difficult.

@usefulthink
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants