Skip to content

"Map container is being reused by another instance" when using the new React Activity componentΒ #1166

@tomerzcod7

Description

@tomerzcod7

Expected behavior

React new Activity component should be perfect to offload the map for lower priority rendering and preserving state. However it seems like the MapContainer implementation does not support it properly

https://react.dev/reference/react/Activity

Actual behavior

You get the following error in the console:
"Map container is being reused by another instance"

Steps to reproduce

Using the Activity component and toggle between hiding and viewing the map container:

<Activity mode={activeTab === 'map' ? 'visible' : 'hidden'}>
  <MapContainer center={center} zoom={zoom}>
    <TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
  </MapContainer>
</Activity>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions