Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fermata fixes apr17 #1146

Merged
merged 3 commits into from
Apr 20, 2024
Merged

Conversation

JGreenlee
Copy link
Collaborator

  • UserInputButton: before appConfig is defined, don't show default survey

  • in updateUnprocessedBleScans, await call to getUnifiedDataForInterval

    Without the 'await' keyword here, execution would continue without the request being completed.
    This would cause the BLE scans to sometimes not be considered while rendering and evaluating conditional surveys.
    If the BLE scans took longer to load than the trips took to render, there would be no surveys prompted.
    Thus, we must 'await' to make sure the BLE scans are loaded first.

  • cacheResourcesFromConfig: reload the cache when config is downloaded

    We recently added the ability to refresh the config from inside the app.
    But whenever the config is downloaded for the first time, we cache the resources referenced in it by URL. Subsequent config downloads would still use the resources from the first time.

    fetchUrlCached now accepts options to pass through to the fetch API; if cache is 'reload', we will skip checking our localStorage cache for a previously stored value. This option will also cause the fetch API will also skip its own internal cache

    The result of this is that when we refresh the config, URL-referenced resources inside it will also be refreshed.

Without the 'await' keyword here, execution would continue without the request being completed.
This would cause the BLE scans to sometimes not be considered while rendering and evaluating conditional surveys.
If the BLE scans took longer to load than the trips took to render, there would be no surveys prompted.
Thus, we must 'await' to make sure the BLE scans are loaded first.
We recently added the ability to refresh the config from inside the app.
But whenever the config is downloaded for the first time, we cache the resources referenced in it by URL. Subsequent config downloads would still use the resources from the first time.

fetchUrlCached now accepts options to pass through to the fetch API; if cache is 'reload', we will skip checking our localStorage cache for a previously stored value. This option will also cause the fetch API will also skip its own internal cache

The result of this is that when we refresh the config, URL-referenced resources inside it will also be refreshed.
Comment on lines +18 to +19
logDebug(`fetchUrlCached: cache had ${stored} for url ${url}, not using; fetching`);
const response = await fetch(url, fetchOpts);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own understanding, we also cache separately in the localStorage. This is just to ensure that the HTTP cache (if any) also does not return obsolete values. The log statement prints the value from the localStorage cache.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

@shankari shankari merged commit b9dd3ba into e-mission:master Apr 20, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants