Skip to content

[Feature]: Improve vector layer loading with caching and request deduplication #363

Description

@Athina09

Related Page / Route

None

Feature Description

Problem
getVectorLayers fetches the same WFS/GeoJSON endpoint repeatedly when users toggle layers or revisit the same view. This causes unnecessary network calls, slower layer rendering, and extra load on GeoServer.

Proposed Enhancement
Add request-level caching and in-flight request deduplication in src/actions/getVectorLayers.js.

Scope
Cache layer responses in memory, keyed by request URL.
Add cache TTL (e.g., 5 minutes) to avoid stale data persisting forever.
Deduplicate concurrent requests so the same URL is fetched only once at a time.
Add a forceRefresh option to bypass cache when required.
Expected Outcome
Faster layer load times for repeated requests.
Reduced duplicate network traffic.
Better user experience when toggling/reopening layers.
Lower backend load from repetitive WFS calls.
Acceptance Criteria
Repeated calls to the same URL within TTL return cached data.
Concurrent requests for the same URL share one network request.
Cache expires automatically after TTL.
forceRefresh=true always fetches fresh data.
No regressions in existing layer rendering behavior.
Notes
This should be implemented in a way that is transparent to existing callers, with backward-compatible defaults.

Problem it Solves

No response

Suggested Implementation

No response

Mockups / Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions