Skip to content

Sayali: optimize TotalOrgSummary date range loading with parallel API calls, debounce, and caching#5019

Merged
one-community merged 1 commit intodevelopmentfrom
Sayali_Optimize_TotalOrgSummary_DateRange
Apr 4, 2026
Merged

Sayali: optimize TotalOrgSummary date range loading with parallel API calls, debounce, and caching#5019
one-community merged 1 commit intodevelopmentfrom
Sayali_Optimize_TotalOrgSummary_DateRange

Conversation

@sayali-2308
Copy link
Copy Markdown
Contributor

@sayali-2308 sayali-2308 commented Mar 19, 2026

image

Description

Implements #(TaskNumber) (Priority Medium)

Related PRS (if any):

Backend PR related to frontend PR - HGNRest Sayali_Optimize_TotalOrgSummary_DateRange
OneCommunityGlobal/HGNRest#2111

Main changes explained:

  • Updated TotalOrgSummary.jsx to run both API calls in parallel using Promise.all instead of sequential awaits
  • Added 300ms debounce on date range changes to prevent redundant API calls on rapid selection
  • Added frontend in-memory cache (cacheRef) to serve previously fetched date ranges instantly
  • Added request cancellation flag to prevent stale responses from updating state

How to test:

  1. Check out branch Sayali_Optimize_TotalOrgSummary_DateRange
  2. npm install && npm run start:local
  3. Clear cache, log in as admin
  4. Navigate to Dashboard → Total Org Summary
  5. Select a date range - verify data loads with spinner
  6. Switch to a different date range, then switch back to the first one - verify it loads instantly (no spinner)
  7. Rapidly change date ranges - verify only one API call fires after 300ms
  8. Verify dark mode works

Screenshots or videos of changes:

image image image image

Note:

Backend PR must be merged alongside this for full optimization benefit (server-side caching).

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 19, 2026

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 33f74d7
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69bb7ec928afe400082d4cac
😎 Deploy Preview https://deploy-preview-5019--highestgoodnetwork-dev.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.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@HemanthNidamanuru HemanthNidamanuru left a comment

Choose a reason for hiding this comment

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

Hi Sayali,

I tested this PR locally and everything is working as expected. The spinner loads correctly, cached date ranges load instantly, debouncing works fine, and dark mode looks good.

Image Image Image Image

Copy link
Copy Markdown

@Vishnu10-hub Vishnu10-hub left a comment

Choose a reason for hiding this comment

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

Hi,

Checked branch Sayali_Optimize_TotalOrgSummary_DateRange. Verified Dashboard → Total Org Summary with different date ranges, spinner behavior, API calls optimization, and dark mode — everything is working as expected.

Image Image Image Image

Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

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

Hi Sayali,

I have tested the PR locally and the API calls for repeated date ranges load immediately and for new one's the spinner appears as per requriement.

Image Image Image Image

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit 33c0448 into development Apr 4, 2026
10 checks passed
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.

5 participants