Skip to content

Elevation Map Missing Fallback on Mobile #394

@SvenVw

Description

@SvenVw

Description

On Android and iOS devices, the elevation map lacks a proper fallback mechanism when the AHN index (kaartbladen) is requested from the cache. If the cache is invalid, expired, or network connectivity is flaky, the map may fail to render the elevation data completely.

Current Behavior

  • The application attempts to load the AHN index from localStorage.
  • If the cache check fails or throws an error (e.g., in private browsing mode or quota exceeded), the process might be interrupted.
  • There is no mechanism to use "stale" (expired) cache data if the network request fails.

Expected Behavior

  • Robust Cache Handling: Access to localStorage should be safely wrapped in try-catch blocks to prevent crashes or blockers.
  • Cache Alignment: Client-side cache duration should match the server-side configuration (24 hours).
  • Network Resilience:
    • If the cache is valid (fresh), use it.
    • If the cache is expired, try to fetch fresh data from the network.
    • Critical: If the network request fails, fall back to the expired cache (if available) instead of showing an error.

Proposed Solution

  1. Refactor fetchIndex:
    • Add error handling around localStorage access.
    • Implement the "stale-while-revalidate" or "fallback-to-stale" pattern for the AHN index.
    • Update the cache TTL to 24 hours.

Environment

  • OS: Android, iOS
  • Component: Elevation Map (FarmAtlasElevationBlock)

Metadata

Metadata

Assignees

Labels

branch:mainAn issue, affecting the main branch, that requires an hotfixbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions