getodk / getodk/central

Reduce stale data in Frontend

Open
#1,300 1 comment 0 reactions 1 assignee Claimed by @matthew-white View on GitHub
frontend needs testing
Dominant language
JavaScript
Stars
226
Forks
235
Avg merge
2d 22h
Merged PRs (30d)
19

Description

**Update from 2025:** The description below is a bit technical/specific, but the main goal of this issue is to better handle stale data. When I work on this issue, I may end up taking a slightly different approach from the one described below.

---

There are places where we could preserve request data when navigating between routes, but don't because of concerns about data becoming stale and/or inconsistent. (Imagine that the user leaves their computer for a few hours without closing Frontend, then comes back to work in Frontend without refreshing the page.)

Here are a few examples to consider:

* When the user clicks on a form in the project overview, thereby navigating to the form overview, we request the form even though we have already fetched it for the form list. Instead, we could set and preserve `form` when navigating from `ProjectOverview` to `FormOverview`.
* When the user clicks on a form in the project overview, thereby navigating to the form overview, we clear `forms` (the list of forms). It might be nice if the user could return from a form page to the project overview without re-requesting `forms`.
* When the user clicks on a project in `ProjectList` (the root page), the user navigates to the project overview. Right now when that happens, we clear `projects` (the list of projects). It might be nice if the user could return from a project or form page to `ProjectList` without re-requesting `projects`.

One approach I like, suggested by issa, is for us to add an expiration option (to `preserveDataForKey()`) so that the data for specified request keys is preserved when moving from one specified route to another (as now), _unless_ some specified amount of time (two minutes?) has elapsed. That should reduce the chance of stale or inconsistent data.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.