Skip to content

Yk/fm bugbash - #213

Open
Yurika-Kan wants to merge 12 commits into
mainfrom
yk/fm-bugbash
Open

Yk/fm bugbash#213
Yurika-Kan wants to merge 12 commits into
mainfrom
yk/fm-bugbash

Conversation

@Yurika-Kan

@Yurika-Kan Yurika-Kan commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

ℹ️ Issue

FM Bug bash
bugbasheet

📝 Description

  • Route guard missing → gated FM routes with allowedRoles, redirect /unauthorized
  • Header showed 1 manufacturer → join all names (Welcome A, B, ....., and C)
  • False empty state on fetch fail → distinct error state + Retry
  • Concurrent errors overwrote → alerts stack instead of replace jobs
  • Bad donationId silently redirected → show "not found" alert first
  • Pagination reset on any mutation/completing required actions → only reset on initial/deep-link load
  • Shipping/tracking optional, toast lied → message now names what's missing in Complete Required Actions modal
  • Oz/Value accepted 0 → submit gate requires >= 0.01
  • Resubmit had no success toast → added one
  • Dashboard reminder linked to read-only view → links to resubmit flow now

✔️ Verification

2-both-fetches-fail-stacked-alert-fixed

🏕️ (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!

useAlert overwrote its single error slot on each call, so concurrent
fetch failures (stats, reminders, donations) silently dropped all but
the last. Now same-status errors append as separate lines, with exact
duplicates deduped. Affects all four dashboards (admin/FM/pantry/
volunteer) since they share this hook.
fetchDonations() reset all three status tables' current page to 1 on
every successful mutation, even ones scoped to a different table.
Only reset pagination on the initial load/deep-link fetch.
Copilot AI lite review requested due to automatic review settings September 11, 2026 06:07
Delete button had no disabled/loading state, so a fast double-click
fired two delete requests; the second 404s after the first succeeds
and shows a false "could not be deleted" error.
Dialog.Root mounted via `{x && <Modal isOpen={true} />}` opens already
`open=true` on its first render, so focus-trap activates before the
CloseButton ref settles and finds zero focusable elements, throwing
"Your focus-trap needs to have at least one focusable element" to the
error boundary. Add lazyMount/unmountOnExit to every Dialog.Root so Ark
UI defers mounting the content tree until the open transition begins.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Four moderate review findings remain unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves dashboard resilience with retryable error states, alert aggregation, multi-manufacturer support, and donation pagination updates.

Changes:

  • Adds dashboard fetch failure states and retry actions.
  • Supports multiple food manufacturers.
  • Updates alert handling and donation refresh behavior.
File summaries
File Summary Review findings
apps/frontend/src/hooks/alert.ts Aggregates duplicate-status alerts. Moderate (3 votes): repeated errors after timeout are not shown again; issue a new alert ID or reset state.
apps/frontend/src/containers/volunteerDashboard.tsx Adds section-level retry handling. No final findings.
apps/frontend/src/containers/pantryDashboard.tsx Adds section-level retry handling. No final findings.
apps/frontend/src/containers/foodManufacturerDashboard.tsx Supports multiple manufacturers and donation retries. Moderate (3 votes): track reminders failures separately and render an error/retry state instead of an empty result.
apps/frontend/src/containers/adminDashboard.tsx Adds section-level retry handling. No final findings.
apps/frontend/src/containers/foodManufacturerDonationManagement.tsx Updates pagination refresh and missing-donation handling. Moderate (3 votes): clamp preserved pages to the new last page. Moderate (1 vote): only redirect for missing donations after a successful fetch.
Review details

Suppressed comments (1)

apps/frontend/src/containers/foodManufacturerDonationManagement.tsx:168

  • If fetchDonations() fails, it catches the request error and leaves statusDonations empty, while init still clears loading. This effect then reports “Donation not found” and redirects for a valid donation whenever the API is unavailable, masking the fetch error and preventing recovery. Only perform this not-found redirect after confirming that the donations request completed successfully.
    } else {
      setAlertMessage('Donation not found.', AlertStatus.ERROR);
      navigate(ROUTES.FM_DONATION_MANAGEMENT, { replace: true });
  • Files reviewed: 29/29 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/frontend/src/containers/foodManufacturerDashboard.tsx Outdated

// Fetch all donations on component mount and sorts them into their appropriate status lists
const fetchDonations = async () => {
const fetchDonations = async (resetPages = false) => {
Comment thread apps/frontend/src/hooks/alert.ts Outdated
if (prev && prev.status === status) {
const lines = prev.message.split('\n');
if (lines.includes(message)) {
return prev;
Yurika-Kan and others added 3 commits September 11, 2026 02:15
Covers the fix requiring ozPerItem/estimatedValue >= 0.01 before
Complete Required Actions submit is enabled. Adds jsdom test
environment to vite config and @testing-library/dom dependency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…y view

Upcoming Donations card sent FM reps to a read-only donation-details
view, while the equivalent reminder email linked straight to the
Resubmit modal. Point the card at ?resubmitDonationId= to match, and
relabel the card and link text accordingly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
reminder.donation.foodManufacturer?.foodManufacturerName
}
linkText="View Donation Requirements"
linkText="Submit Donation"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

"submit recurring donation"?
i think it makes more sense to navigate to the resubmit functionality here but i dont want the wording to be misleading.
needs to be clear that they still need to manually submit it, this is for email reminders

Deleting/resubmitting the last item on a status's last page left
currentPages stale, so PaginationControl hid itself (totalPages<=1)
while the stale page rendered no rows.
…y-state copy

Admin/FM/pantry/volunteer dashboards silently showed no stats block on
getUserStats failure with no way to recover without reload. Adds a
retry button gated on a per-dashboard statsFetchFailed flag.
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.

2 participants