Skip to content

Marker with custom icon re-renders on every change #1159

@11samype

Description

@11samype

Bug report in v5

Before opening an issue, make sure to read the contributing guide and understand this is a bug tracker, not a support platform.

Please make sure to check the following boxes before submitting an issue.
Issues opened without using this template will be closed unless they have a good reason not to follow this template.

  • [x ] All peer dependencies are installed: React, ReactDOM and Leaflet.
  • [ x] Using the latest stable version of React and ReactDOM v19.
  • [ x] Using the supported version of Leaflet (v1.9.0 minimum) and its corresponding CSS file is loaded.
  • [ x] Using the latest v5 version of React-Leaflet.
  • [ x] The issue has not already been reported.
  • [ x] Make sure you have followed the quick start guide for Leaflet.
  • [ x] Make sure you have fully read the documentation and that you understand the limitations.

Expected behavior

I would expect only the element that changed would be re-rendered.

Actual behavior

The whole marker is re-rendered when just changing the position.

Steps to reproduce

Here is a simple example: https://stackblitz.com/edit/react-leaflet-v5-mdsye1mt?file=src%2FApp.tsx

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