Skip to content

[Bug] Updating select mode after instantiation, removes its previous settings. #847

@RLaipins

Description

@RLaipins

Describe the bug
After trying to update snapping behavior of polygon when selected it resets the previous flags/settings.

Terra Draw npm version
terradraw - 1.24.0,
Maplibre adapter - 1.3.0

To Reproduce
Steps to reproduce the behavior:

  1. Have terradraw initated with snappable:true for select mode or any other flags
  2. Have at least 2 polygons drawn (in this case)
  3. Enter select mode and select 1 polygon
  4. Try to snap it to other polygon
  5. Update select mode options programmatically
this.draw?.updateModeOptions<typeof TerraDrawSelectMode>('select', {
      flags: {
        polygon: {
          feature: {
            coordinates: { snappable: false },
          },
        },
      },
    });
  1. See it reset to default flags

Expected behavior

It would take partial updates just how the regular polygon/linestring mode updates work after instantiation without the need to track previous state.

Screenshots
If applicable, add screenshots to help explain your problem.

2026-03-30.16-34-09.mp4

Desktop (please complete the following information):

  • OS: Linux mint
  • Browser: Chrome
  • Version: 146.0.7680.164

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions