Skip to content

fix(geo-editor): dead first click when switching between draw tools (#889) - #1020

Merged
giswqs merged 1 commit into
mainfrom
fix/issue-889-draw-tool-dead-click
Jul 1, 2026
Merged

fix(geo-editor): dead first click when switching between draw tools (#889)#1020
giswqs merged 1 commit into
mainfrom
fix/issue-889-draw-tool-dead-click

Conversation

@giswqs

@giswqs giswqs commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #889. When switching directly from one GeoEditor draw tool to another
(e.g. Marker -> Circle), the first click on the map canvas was unresponsive: the
newly selected tool only started drawing on the second click ("dead click").

Root cause

The bug lives in the maplibre-gl-geo-editor package's Geoman wrapper.
enableDrawMode() called geoman.enableDraw() synchronously while the
previous tool's geoman.disableAllModes() teardown was still in flight (that
call is asynchronous). The in-flight teardown then landed on top of the freshly
enabled draw mode and swallowed its first canvas click.

Fix

Bumps maplibre-gl-geo-editor 0.10.0 -> 0.10.1, which sequences the newly
selected tool's activation after the previous tool's teardown promise settles,
guarded by a monotonic request token so fast reselects (e.g. circle -> line -> circle) can't let a stale request win. Freehand is sequenced the same way.

Verification

The reported symptom is Safari/macOS-specific and timing-dependent; it does not
reproduce on Chromium/Linux (confirmed by the reporter and locally), so this was
verified by the upstream package's unit tests (which cover the deferred enable,
the reselect race, and freehand sequencing) plus root-cause analysis, rather
than a live Safari repro. The fix is browser-agnostic: it removes the sync/async
race regardless of which browser's event timing exposes it. npm run build
passes.

Summary by CodeRabbit

  • Chores
    • Updated a bundled editor dependency to a newer patch version across desktop and plugin packages.

Bump maplibre-gl-geo-editor to 0.10.1, which sequences a newly selected
draw tool after the previous tool's asynchronous Geoman teardown. Before,
enableDraw ran while the prior mode's disableAllModes() was still in
flight, so the teardown swallowed the first canvas click and the new tool
only started drawing on the second click.

Fixes #889
Copilot AI review requested due to automatic review settings July 1, 2026 01:33
@netlify

netlify Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploy Preview for geolibre-app ready!

Name Link
🔨 Latest commit 4e9b544
🔍 Latest deploy log https://app.netlify.com/projects/geolibre-app/deploys/6a446e582a730700082639b6
😎 Deploy Preview https://deploy-preview-1020--geolibre-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2fd3aa43-af07-4b98-88e6-9fb4802571cb

📥 Commits

Reviewing files that changed from the base of the PR and between 485e80a and 4e9b544.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • apps/geolibre-desktop/package.json
  • packages/plugins/package.json

📝 Walkthrough

Walkthrough

This change updates the maplibre-gl-geo-editor dependency version from ^0.10.0 to ^0.10.1 in two package.json files: apps/geolibre-desktop/package.json and packages/plugins/package.json. No other code or configuration changes are included.

Changes

Dependency version bump

Layer / File(s) Summary
Update maplibre-gl-geo-editor version
apps/geolibre-desktop/package.json, packages/plugins/package.json
Both files' dependency entries for maplibre-gl-geo-editor are updated from ^0.10.0 to ^0.10.1.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • opengeos/GeoLibre#496: Also updates the maplibre-gl-geo-editor dependency version in the same two package.json files.
  • opengeos/GeoLibre#1010: Also bumps maplibre-gl-geo-editor in the same two package.json files, from a previous version range.

Poem

A tiny hop, a version bump,
From point-oh-ten to point-oh-one plus 🐇
No dead clicks left to make us frown,
Just fresher code all through the town.
Thump-thump — ship it, no more fuss!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing the dead first click when switching GeoEditor draw tools.
Linked Issues check ✅ Passed Updating maplibre-gl-geo-editor to 0.10.1 aligns with the reported dead-click fix in issue #889.
Out of Scope Changes check ✅ Passed The diff only updates the targeted dependency versions and introduces no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-889-draw-tool-dead-click

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates GeoLibre’s GeoEditor integration to pick up the upstream fix for the “dead first click” when switching directly between draw tools (e.g., Marker → Circle), by bumping maplibre-gl-geo-editor from 0.10.0 to 0.10.1.

Changes:

  • Bump maplibre-gl-geo-editor dependency to ^0.10.1 where it is consumed.
  • Update package-lock.json to lock maplibre-gl-geo-editor@0.10.1 (resolved URL + integrity).
  • Ensure both the desktop app and plugins package align on the same bumped version.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
packages/plugins/package.json Bumps maplibre-gl-geo-editor to ^0.10.1 for the plugins workspace.
apps/geolibre-desktop/package.json Bumps maplibre-gl-geo-editor to ^0.10.1 for the desktop app.
package-lock.json Locks the dependency graph to maplibre-gl-geo-editor@0.10.1 and updates metadata accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Reviewed via gh pr diff/gh pr view. The change set is a pure dependency bump: maplibre-gl-geo-editor ^0.10.0 -> ^0.10.1 in apps/geolibre-desktop/package.json and packages/plugins/package.json, plus the corresponding package-lock.json update. No source files in this repo change — the actual race-condition fix (sequencing enableDraw() after the prior tool's in-flight disableAllModes() teardown) lives entirely in the upstream package.

Bugs: None found. There is no application logic in this diff to introduce a regression; I confirmed geoEditorControl's draw-mode entry points used in packages/plugins/src/plugins/maplibre-geo-editor.ts (e.g. disableActiveEditModes(), getState()) are unaffected by the version bump's public API. (Confidence: high)

Security: None found. No new dependencies, no changed network/input-handling code, no secrets. (Confidence: high)

Performance: None found. Not applicable to a patch-version dependency bump. (Confidence: high)

Quality:

  • The package.json bump is consistently applied to both direct dependents (apps/geolibre-desktop, packages/plugins), and package-lock.json shows a single de-duplicated, hoisted node_modules/maplibre-gl-geo-editor entry at 0.10.1 — no stray un-bumped nested copies. (Confidence: high)
  • Minor observation: this repo has no regression test (e2e or otherwise) covering the tool-switch dead-click scenario; the PR description explains this is because the race is timing/Safari-specific and doesn't reproduce under Playwright/Chromium, and reliance is placed on the upstream package's own unit tests instead. That's a reasonable call given the constraint, just flagging it as a coverage gap worth being aware of rather than a defect. (Confidence: low)

CLAUDE.md: No violations. The branch (fix/issue-889-draw-tool-dead-click) targets main via PR per convention, and the change doesn't touch any of the areas CLAUDE.md calls out for special handling (CSP allowlist, i18n strings, MapLibre control CSS overrides, etc.). (Confidence: high)

No inline comments were posted — nothing in this diff rose to a level warranting a line-anchored finding.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

⚡ Cloudflare Pages preview

Item Value
Preview https://f0d01aa8.geolibre-preview.pages.dev
Demo app https://f0d01aa8.geolibre-preview.pages.dev/demo/
Commit d23bfe4

@giswqs
giswqs merged commit ea1fd6d into main Jul 1, 2026
21 checks passed
@giswqs
giswqs deleted the fix/issue-889-draw-tool-dead-click branch July 1, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: First click after switching tools in GeoEditor toolbar is unresponsive (Dead Click)

2 participants