Skip to content

Fix: Assessment History table bypassing computed filtered assessment results#1745

Open
AanyaJain0811 wants to merge 3 commits into
gopaljilab:mainfrom
AanyaJain0811:fix/history-table-filter-sync
Open

Fix: Assessment History table bypassing computed filtered assessment results#1745
AanyaJain0811 wants to merge 3 commits into
gopaljilab:mainfrom
AanyaJain0811:fix/history-table-filter-sync

Conversation

@AanyaJain0811

Copy link
Copy Markdown
Contributor

Description

The assessment history table rendered from paginatedAssessments, a variable that was never defined anywhere in the component — it had no declaration, state, or memo backing it. Meanwhile, a correctly-implemented filteredAssessments memo (built from filterAssessments()) existed but was never read. As a result, search and filter controls had no effect on the rendered table.

Related Issue

Closes #1744

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style / UI improvement
  • ♻️ Refactor (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or update
  • 🔧 Chore / Tooling / Config

Changes Made

  • Fixed the assessment history table referencing an undefined paginatedAssessments variable instead of the existing filteredAssessments memo, so search/filter UI never affected the rendered rows
  • Switched pagination math (filteredRecords, totalPages, safePage) to derive from the client-filtered array instead of server-side totals, since filterAssessments() performs logic (multi-field text search, custom gender handling) the backend doesn't replicate
  • sortedAssessments is now a correctly paginated slice of filteredAssessments, used consistently by the table, the comparison card, and badge calculations
  • Updated PDF export (exportFilteredPdf) and CSV export (exportFilteredCsv) to serialize filteredAssessments directly instead of re-querying the server with separate filter params, so exports always match what's visible in the table
  • Removed the now-unused buildExportParams helper

Screenshots (if applicable)

N/A — logic fix, no visual/layout changes

Testing

  • I have tested these changes locally
  • I have added/updated tests where applicable
  • All existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • I have updated the documentation if needed
  • My changes generate no new warnings or errors

Known Limitation

This fix fetches up to 1000 records (limit: 1000) and filters/paginates entirely client-side, since the backend's filter semantics don't match filterAssessments(). If the assessment count grows past that threshold, this should be revisited — either raise the limit, add a dedicated "export/fetch all matching" backend endpoint, or move filtering server-side and bring it in line with filterAssessments()'s logic exactly.

- Add useTranslation hook to History.tsx, Dashboard.tsx, MyHealth.tsx
- Replace hardcoded English strings in EmptyState components with t() calls
- Add translation keys to en, es, fr, hi translation.json files
- Fixes empty-state messages not translating when language is switched
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@AanyaJain0811 is attempting to deploy a commit to the gopaljilab's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added type:bug Something isn't working or throwing errors. labels Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something isn't working or throwing errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Assessment History table may bypass computed filtered assessment results

1 participant