-
Notifications
You must be signed in to change notification settings - Fork 13
fix: update cmr query key to cache bust on start and end date #1928
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,7 +167,7 @@ export function formatCMRResponse(statResponse: CMRStatistics): TimeseriesData { | |
| return cmrResponse; | ||
| } | ||
|
|
||
| export async function requestCMRTimeseriesData({ | ||
| async function requestCMRTimeseriesData({ | ||
| start, | ||
| end, | ||
| aoi, | ||
|
|
@@ -236,7 +236,7 @@ export async function requestCMRTimeseriesData({ | |
| ? datasetData.tileApiEndpoint.replace('WebMercatorQuad/tilejson.json', '') | ||
| : envApiCMREndpoint; | ||
| const statResponse = await queryClient.fetchQuery( | ||
| ['analysis', datasetData.id, 'cmr', aoi], | ||
| ['analysis', datasetData.id, 'cmr', aoi, start, end], | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I notice we don't use the formattedParamString in the query key. This leads me to believe it's desired that not all params should cache bust this query. In that case, are there any additional params I should add?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question! For this dataset, the only parameters that actually vary with user interaction are
|
||
| async ({ signal }) => { | ||
| const { data } = await axios.post( | ||
| `${cmrTitilerEndpoint}/timeseries/statistics/?${formattedParamString}`, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is not used elsewhere. if functions are exported solely for tests, I suggest we prefix with
private_or_so we can add a eslint rule to prevent imports of these functions outside of tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup! I agree with removing the export. We generally rely on module scope (exported vs. non-exported) to signal privacy rather than using naming prefixes like
private_.I think if we ever need to reuse this logic elsewhere, we should extract it into a dedicated util file or custom hook at that point. But for now, keeping it non-exported here is perfect.