Skip to content

Improve vector layer loading with caching and request deduplication#364

Open
Athina09 wants to merge 17 commits intocore-stack-org:developmentfrom
Athina09:feat/layer-search
Open

Improve vector layer loading with caching and request deduplication#364
Athina09 wants to merge 17 commits intocore-stack-org:developmentfrom
Athina09:feat/layer-search

Conversation

@Athina09
Copy link
Copy Markdown

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.

apple added 17 commits March 7, 2026 13:40
…andscape visible

- Make scroll container explicit (flex layout, main scrolls only)
- Use scroll-snap proximity and GPU layer for smoother scroll
- Replace backdrop-blur on sections with bg-white/10 to reduce jank
- Fix layout: h-screen + navbar + footer so first section shows below navbar
- Add landing-scroll-container CSS (scroll-padding, -webkit-overflow-scrolling)
- Semantic structure: header, main, footer with shrink-0 for stable layout

Made-with: Cursor
…l-behavior, scroll-margin

Made-with: Cursor
Adds a lightweight search box to filter layers by label/name in the right sidebar, making it faster to find layers without API changes.

Made-with: Cursor
…and deduplicating in-flight requests.

This reduces repeated GeoJSON fetches for the same layer URL, lowers server load, and adds a force-refresh path when fresh data is needed.

Made-with: Cursor
OpenLayers setStyle replaces the previous style; apply the default blue fill
only when layer_store is not panchayat_boundaries.

Made-with: Cursor
Dispatch VECTOR_LAYER_LOAD_ERROR_EVENT from getVectorLayers on HTTP errors,
fetch failures, and invalid GeoJSON; Map listens and merges into layerErrors.
Add dismiss control for the notification panel.

Made-with: Cursor
Use OpenLayers vector loader callbacks so featuresloadend/error fire correctly.
Remove unused url option with custom loader. Prune expired cache entries on
fetch. Parse features with featureProjection like the built-in XHR loader.

Made-with: Cursor
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.

1 participant