react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

[Bug] `renderingType` is incompatible with `reuseMaps`

Open anliting opened this issue 1 year ago • 1 comments

Description

I get an error like this:

Uncaught Error: Setting map 'renderingType' after instantiation is not supported.

It does not throw if only one of renderingType and reuseMaps is supplied.

Steps to Reproduce

  1. Create a Map like this:
<Map
    renderingType={google.maps.RenderingType.VECTOR}
    reuseMaps
/>
  1. Mount it.
  2. Unmount it.
  3. Mount it.

Environment

  • Library version: 1.1.0
  • Google maps version: weekly
  • Browser and Version: Google Chrome 127.0.6533.72
  • OS: Arch Linux

Logs

main.js:6937 Uncaught Error: Setting map 'renderingType' after instantiation is not supported.
    at lca.renderingType_changed (main.js:367:1635)
    at Xk (main.js:140:251)
    at Xk (main.js:140:311)
    at _.Vk.set (main.js:260:719)
    at jo.setRenderingType (main.js:148:354)
    at _.Vk.setValues (main.js:261:242)
    at main.js:23769:12
    at commitHookEffectListMount (main.js:6949:114)
    at commitPassiveMountOnFiber (main.js:7162:1577)
    at commitPassiveMountEffects_complete (main.js:7162:872)

anliting avatar Aug 06 '24 08:08 anliting

I wasn't aware that the renderingType can't be changed after the map is created, we'll have to adjust our implementation so renderingType is treated like the mapId, creating a new map instance when changed this should then also make it work with reuseMaps.

usefulthink avatar Aug 07 '24 08:08 usefulthink