Conversation
There was a problem hiding this comment.
Pull request overview
Updates the grants page UX so that after creating a grant, the newly created grant is immediately selected/shown, and filters are cleared only when they would hide that new grant (per issue #393). Also fixes the status filter UI so it correctly reflects store changes when the status filter is cleared.
Changes:
- Added an
onGrantCreatedcallback fromEditGranttoGrantPageto select the newly created grant and clear filters when needed. - Updated grant creation to return the created
grantIdfrom the API response. - Removed local
selectedStatusstate inFilterBarand bound the status dropdown directly to the store’sfilterStatus.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/main-page/grants/GrantPage.tsx | Selects newly created grant and conditionally clears filters to ensure visibility. |
| frontend/src/main-page/grants/filter-bar/FilterBar.tsx | Uses store filterStatus directly so UI reflects cleared status correctly. |
| frontend/src/main-page/grants/edit-grant/processGrantDataEditSave.ts | Returns created grant ID from createNewGrant for downstream selection. |
| frontend/src/main-page/grants/edit-grant/EditGrant.tsx | Propagates created grant ID via optional onGrantCreated callback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const { | ||
| allGrants, | ||
| filterStatus, | ||
| startDateFilter, | ||
| endDateFilter, | ||
| yearFilter, | ||
| searchQuery, | ||
| emailFilter, | ||
| eligibleOnly, | ||
| amountMinFilter, | ||
| amountMaxFilter, | ||
| user, | ||
| } = getAppStore(); | ||
|
|
||
| const createdGrant = allGrants.find((grant) => grant.grantId === grantId); | ||
|
|
||
| if (createdGrant) { | ||
| const grantIsVisible = | ||
| filterGrants([createdGrant], [ | ||
| statusFilter(filterStatus), | ||
| eligibleFilter(eligibleOnly), | ||
| dateRangeFilter(startDateFilter, endDateFilter), | ||
| amountRangeFilter(amountMinFilter, amountMaxFilter), | ||
| yearFilterer(yearFilter), | ||
| searchFilter(searchQuery), | ||
| userEmailFilter(emailFilter, user), | ||
| ]).length > 0; | ||
|
|
There was a problem hiding this comment.
handleGrantCreated re-implements the full grant filtering pipeline inline (status/eligible/date/amount/year/search/email). This duplicates the predicate list used in ProcessGrantData, so adding/changing filters later could make the “is created grant visible?” check drift from what the page actually renders. Consider extracting a shared helper that builds the predicate list from the store (and reuse it in both places), so visibility checks stay consistent over time.
ℹ️ Issue
Closes #393
📝 Description
Write a short summary of what you added. Why is it important? Any member of C4C should be able to read this and understand your contribution -- not just your team members.
Briefly list the changes made to the code:
✔️ Verification
What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.
Provide screenshots of any new components, styling changes, or pages.
I tested this on my branch with different cases of filters needing to be cleared and not.
Test Changes
If your new feature required some test to be changed or added to fit the new functionality or changes please document these changes here.
N/A
🏕️ (Optional) Future Work / Notes
Did you notice anything ugly during the course of this ticket? Any bugs, design challenges, or unexpected behavior? Write it down so we can clean it up in a future ticket!
Not sure if this will be fixed but this card is not super responsive
