Skip to content

Conversation

@ifsimicoded
Copy link
Contributor

@ifsimicoded ifsimicoded commented Nov 22, 2025

Related Ticket:
Closes: #1897

Description of Changes

Updated the query key on the CMR time series stats endpoint to include start and end date for cache bust. This will refetch, even if the new date range stats was included in the prior fetch, so this isn't as optimized as it could be for caching. But this was the simplest approach without adding additional logic to check if the dates were exclusive of the previously set range.

Notes & Questions About Changes

Curious if there are other parameters missing in this query key that should be added?

Validation / Testing

This would impact any CMR dataset available for timeseries analysis. I tested using the original branch the bug was reported on as this branch provided the CMR dataset for testing. When going through every dataset available on veda-ui in my local env, I was unable to find a valid CMR dataset. I suggest pulling in the commit46eb610bd5d0e3f6eef29b8cf62a74d05e1b7ad8 from the bug report branch into your local to test.

@ifsimicoded ifsimicoded self-assigned this Nov 22, 2025
@netlify
Copy link

netlify bot commented Nov 22, 2025

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit 67f796d
🔍 Latest deploy log https://app.netlify.com/projects/veda-ui/deploys/69211b133924100008bbc51d
😎 Deploy Preview https://deploy-preview-1928--veda-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

: envApiCMREndpoint;
const statResponse = await queryClient.fetchQuery(
['analysis', datasetData.id, 'cmr', aoi],
['analysis', datasetData.id, 'cmr', aoi, start, end],
Copy link
Contributor Author

@ifsimicoded ifsimicoded Nov 22, 2025

Choose a reason for hiding this comment

The 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?

datasetData.timeInterval?

Copy link
Collaborator

@dzole0311 dzole0311 Nov 24, 2025

Choose a reason for hiding this comment

The 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 start, end and the aoi.

datasetData.timeInterval?

timeInterval is a bit different. It’s a fixed prop of the dataset (eg. 'P1M' for monthly data) and comes straight from the config. With the current UI and architecture, users never change it and the backend (I think) doesn’t treat it as a dynamic input. Because of that, we don't have to include it in the key here.

}

export async function requestCMRTimeseriesData({
async function requestCMRTimeseriesData({
Copy link
Contributor Author

@ifsimicoded ifsimicoded Nov 22, 2025

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.

Copy link
Collaborator

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.

Copy link
Collaborator

@dzole0311 dzole0311 left a comment

Choose a reason for hiding this comment

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

Tested with the Ozone Concentration CMR dataset:

  1. Analysis runs correctly
  2. Updating the time range and rerunning now works as expected

Thanks for the fix @ifsimicoded!

: envApiCMREndpoint;
const statResponse = await queryClient.fetchQuery(
['analysis', datasetData.id, 'cmr', aoi],
['analysis', datasetData.id, 'cmr', aoi, start, end],
Copy link
Collaborator

@dzole0311 dzole0311 Nov 24, 2025

Choose a reason for hiding this comment

The 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 start, end and the aoi.

datasetData.timeInterval?

timeInterval is a bit different. It’s a fixed prop of the dataset (eg. 'P1M' for monthly data) and comes straight from the config. With the current UI and architecture, users never change it and the backend (I think) doesn’t treat it as a dynamic input. Because of that, we don't have to include it in the key here.

}

export async function requestCMRTimeseriesData({
async function requestCMRTimeseriesData({
Copy link
Collaborator

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.

@ifsimicoded ifsimicoded merged commit 3145f09 into main Nov 24, 2025
10 checks passed
@ifsimicoded ifsimicoded deleted the fix/1897/sd_fix_time_series_cmr_query_cache branch November 24, 2025 16:40
slesaad added a commit to US-GHG-Center/veda-config-ghg that referenced this pull request Dec 9, 2025
- # Changelog
- ## 🎉 Features
- feat: Expose VedaMap
[#1878](NASA-IMPACT/veda-ui#1878)
- feat: migrate ExternalLinkFlag to USWDS
[#1887](NASA-IMPACT/veda-ui#1887)
- feat: Share button to URL shortener
[#1905](NASA-IMPACT/veda-ui#1905)
- feat: embed mode for e&a
[#1922](NASA-IMPACT/veda-ui#1922)
- ## 🚀 Improvements
  - chore: trigger netlify redeploy
- refactor: Preset selector
[#1874](NASA-IMPACT/veda-ui#1874)
- refactor: retire Collecticons
[#1893](NASA-IMPACT/veda-ui#1893)
- refactor: migrate dataset layer card icons to USWDS
[#1891](NASA-IMPACT/veda-ui#1891)
- refactor: Replace Collecticons in legacy footer and connections
section [#1890](NASA-IMPACT/veda-ui#1890)
- refactor: migrate catalog components to USWDS (except catalog-card)
[#1888](NASA-IMPACT/veda-ui#1888)
- ci: prevent cleanup from deleting latest valid release tag
[#1910](NASA-IMPACT/veda-ui#1910)
- ci: disable the slack notifications until we stabilize the release
workflow [#1909](NASA-IMPACT/veda-ui#1909)
- ci: re-enable slack notifications for failed releases
[#1911](NASA-IMPACT/veda-ui#1911)
- docs: Update development instructions for storybook
[#1914](NASA-IMPACT/veda-ui#1914)
- test: Add micasa to mock datasets for testing cmr timeseries
[#1896](NASA-IMPACT/veda-ui#1896)

 
- ## 📊 Dataset Updates
- fix: Updates for SEDAC dataset landing
page[#840](#840)
- ## 📝 Stories Updates
 - ## 🐛 Fixes
- fix: make release workflow idempotent and reset version to last
successful release
[#1908](NASA-IMPACT/veda-ui#1908)
- fix: wmts copy url
[#1886](NASA-IMPACT/veda-ui#1886)
- fix: 744/search bar fix
[#1903](NASA-IMPACT/veda-ui#1903)
- fix: Rename React component files from .js to .jsx
[#1901](NASA-IMPACT/veda-ui#1901)
- fix: migrate scrollytelling from CollecticonCircleXmark to USWDS
[#1885](NASA-IMPACT/veda-ui#1885)
- fix: remove Collecticons from EmptyHub and TimelineZoomControls
components [#1884](NASA-IMPACT/veda-ui#1884)
- fix: [veda-ui-1864] Update colormapscale to default to mdx rescale
[#1916](NASA-IMPACT/veda-ui#1916)
- fix: properly load API_URL_SHORTENER_ENDPOINT through VedaUI context
[#1924](NASA-IMPACT/veda-ui#1924)
- fix: Guided tour doesn't work in exported ExplorationAndAnalysis
component [#1921](NASA-IMPACT/veda-ui#1921)
- fix: selected pill alignment in data-catalog layer component
[1932](NASA-IMPACT/veda-ui#1932)
- fix: update compare swiper interactions to prevent interaction with
map controls [#1930](NASA-IMPACT/veda-ui#1930)
- fix: guard WMS date domain lookup in scrollytelling
[1926](NASA-IMPACT/veda-ui#1926)
- fix: update cmr query key to cache bust on start and end date
[#1928](NASA-IMPACT/veda-ui#1928)
- fix: add missing export for embedded exploration
[#1933](NASA-IMPACT/veda-ui#1933)
- fix: 1068 update mapbox compare
[#1947](NASA-IMPACT/veda-ui#1947)
- fix: Fix EMIT Bug with Overlapping Plumes
[#798](US-GHG-Center/ghgc-architecture#798)
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.

[Bug] "Apply changes" doesn't change the time series display when creating timeseries for cmr layers

3 participants