Skip to content

make filters for admin updates work#147

Open
DerrickThrower wants to merge 4 commits into
mainfrom
updatefilterfix
Open

make filters for admin updates work#147
DerrickThrower wants to merge 4 commits into
mainfrom
updatefilterfix

Conversation

@DerrickThrower
Copy link
Copy Markdown
Contributor

@DerrickThrower DerrickThrower commented Apr 29, 2026

Description

Shoutout bug bash and Jen because the filter weren't actually doing anything so I fixed that

Screenshots/Media

Screenshot 2026-04-29 at 12 45 05 PM Screenshot 2026-04-29 at 12 44 49 PM

Summary by cubic

Fixes broken filters on the Admin Updates page. Filters now work on both Program and Media tabs, with correct day-based date matching, invalid-date handling, and proper Status fallback.

  • Bug Fixes
    • Wired UpdatesFilterPopover to state and passed activeFilters to tables.
    • Switched filter columns per tab and reset filters when tabs change.
    • Preserved media status values; derive "Resolved"/"Unresolved" only when missing.
    • Updated date ops (is, before, after) to compare by day (YYYY-MM-DD) and guard against invalid dates.

Written for commit 3c279ba. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="client/src/contexts/hooks/TableFilter.js">

<violation number="1" location="client/src/contexts/hooks/TableFilter.js:17">
P1: Date filters can now throw at runtime because `toISOString()` is called without validating parsed dates first.</violation>
</file>

<file name="client/src/components/updates/config/useUpdatesPageData.js">

<violation number="1" location="client/src/components/updates/config/useUpdatesPageData.js:13">
P2: Do not overwrite existing `item.status` in shared mapping; this breaks media status values like `Approved` used by filters.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread client/src/contexts/hooks/TableFilter.js Outdated
Comment thread client/src/components/updates/config/useUpdatesPageData.js Outdated
Copy link
Copy Markdown
Member

@alexy-ok alexy-ok left a comment

Choose a reason for hiding this comment

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

For this one, could you format the filter to be like the one in programs table
image

@alexy-ok
Copy link
Copy Markdown
Member

gurt: yo

Copy link
Copy Markdown
Contributor

@fluffylenny fluffylenny left a comment

Choose a reason for hiding this comment

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

yay most of the filters work, just some small fixes needed w the update date filters :>

before: (dataVal, filterVal) => new Date(dataVal) < new Date(filterVal),
after: (dataVal, filterVal) => new Date(dataVal) > new Date(filterVal),
toDateStr(dataVal) !== null && toDateStr(dataVal) === toDateStr(filterVal),
before: (dataVal, filterVal) =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fix: the "before" filter for update date doesn't work in some cases and displays updates made after and on the same day as the selected date.

Image

toDateStr(dataVal) !== null &&
toDateStr(filterVal) !== null &&
toDateStr(dataVal) < toDateStr(filterVal),
after: (dataVal, filterVal) =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fix: the "after" filter for update time doesn't work in some cases and still displays program updates from before and on the same day as the selected date.

Image Image

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.

3 participants