Skip to content

feat: add Geolocation API#23527

Open
Artur- wants to merge 13 commits intomainfrom
feature/geo
Open

feat: add Geolocation API#23527
Artur- wants to merge 13 commits intomainfrom
feature/geo

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented Feb 15, 2026

Wraps the browser's Geolocation API with two entry points:

  • Geolocation.get() for one-shot position
  • Geolocation.track() for continuous tracking via Signals, automatically tied to the owner component's lifecycle

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 15, 2026

Test Results

 1 393 files  + 2   1 393 suites  +2   1h 20m 5s ⏱️ - 1m 26s
 9 967 tests +20   9 896 ✅ +20  71 💤 ±0  0 ❌ ±0 
10 442 runs  +20  10 362 ✅ +20  80 💤 ±0  0 ❌ ±0 

Results for commit 827ce10. ± Comparison against base commit 8f42c5a.

♻️ This comment has been updated with latest results.

@Artur- Artur- marked this pull request as ready for review February 21, 2026 11:09
@sonarqubecloud
Copy link
Copy Markdown

Provides access to the browser's Geolocation API with two usage modes:

- get(): one-shot position request with success/error callbacks
- track(): continuous tracking via a reactive Signal tied to a
  component's lifecycle, using a GeolocationState sealed type
  (Pending | GeolocationPosition | GeolocationError) that enables
  exhaustive pattern matching

Includes records for coordinates, position, error, and options,
a JS module that bridges navigator.geolocation to Vaadin's event
system, and unit + integration tests.
@mshabarov mshabarov requested a review from platosha March 2, 2026 12:41
Dustin4444

This comment was marked as spam.

Artur- added 7 commits March 15, 2026 12:19
Convert the plain JS geolocation module to TypeScript with typed
interfaces matching the Java records, and move it from flow-server
to flow-client where other core client infrastructure lives.

The module is loaded via flow-client's index.ts entry point instead
of a @jsmodule annotation, following the same pattern as Flow.ts.
Signal.get() requires a reactive context, which unit tests don't
have. Use peek() to read signal values without dependency tracking,
matching the pattern used by other signal tests in the codebase.
Import Geolocation from Flow.ts instead of index.ts, since Flow.ts
is what Vite actually bundles at runtime. Add empty export to make
TypeScript emit it as an ES module.

Fix track IT test race condition by listening for the DOM event
directly instead of polling the signal after a single JS round-trip.
Use peek() in view code since it runs outside a reactive context.

Add debug div to GeolocationView to report geolocation API status.
Artur- added a commit to vaadin/flow-components that referenced this pull request Apr 11, 2026
Extends the Geolocation API with stop(), isSupported(), queryPermission(),
the GeolocationPermission and GeolocationErrorCode enums, and a Duration-
accepting builder on GeolocationOptions. Javadoc across the package is
rewritten for Java developers who do not read the underlying JS API, and
the TypeScript helper drops fallbacks that are only relevant to browsers
outside the supported set (Safari < 17 Apple-epoch timestamps, defensive
feature checks).
The Vaadin serialization tests scan all inner classes and require them
to be Serializable. Builder was missing the marker interface.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🔎Iteration reviews

Development

Successfully merging this pull request may close these issues.

6 participants