Skip to content

PM-4777: Fixed select All in status dropdown#1720

Open
Harshitchudasama wants to merge 3 commits intodevfrom
PM-4777
Open

PM-4777: Fixed select All in status dropdown#1720
Harshitchudasama wants to merge 3 commits intodevfrom
PM-4777

Conversation

@Harshitchudasama
Copy link
Copy Markdown
Collaborator

@Harshitchudasama Harshitchudasama commented Apr 10, 2026

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/

What's in this PR?

PM-4777: Fixed select All in status dropdown


Open with Devin

const hasSelectedStatusFilter = (filters.status?.length ?? 0) > 0
const appliedFilters = React.useMemo<Record<string, string[]>>(() => {
// const hasSelectedStatusFilter = (filters.status?.length ?? 0) > 0
const hasSelectedStatusFilter = (filters.status?.length ?? 0) > 0 && filters.status?.[0] !== 'all'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Leftover commented code?

const hasSelectedStatusFilter = (filters.status?.length ?? 0) > 0 && filters.status?.[0] !== 'all'

/* const appliedFilters = React.useMemo<Record<string, string[]>>(() => {
if (!restrictedCategory) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here too I guess

)
const selectedValueOverrides = React.useMemo<Record<string, string>>(() => {
/* const selectedValueOverrides = React.useMemo<Record<string, string>>(() => {
if (!restrictedCategory) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same ^

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

// Reflect the user's explicit status choice in the dropdown display.
// Do not inject restrictedDefaultStatus here — it applies to the API query
// via appliedFilters but must not override the dropdown's "All" default.
const statusOverride = filters.status?.[0] !== 'all' ? filters.status?.[0] : undefined
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.

🟡 Status dropdown shows "All" while API silently filters by ON_HOLD_ADMIN for restricted approver views

For engagement payment approvers (restricted view), the status dropdown now displays "All" on initial load and when the user explicitly selects "All", but the API query actually filters by ON_HOLD_ADMIN via appliedFilters (line 212). This is a regression from the pre-PR behavior where the dropdown correctly displayed "On Hold (Admin)" matching the actual API filter.

Mechanism of the mismatch

Pre-PR, selectedValueOverrides at line 229 used filters.status?.[0] ?? restrictedDefaultStatus, which defaulted to 'ON_HOLD_ADMIN' — the dropdown accurately reflected the API filter. Post-PR, this was changed to filters.status?.[0] !== 'all' ? filters.status?.[0] : undefined, which evaluates to undefined when filters.status is unset (initial state) or ['all'] (user selected All). Since statusOverride is undefined, no status key is added to selectedValueOverrides. Meanwhile defaultDropdownValues (line 245) sets status: 'all' unconditionally. The merged prop {...defaultDropdownValues, ...selectedValueOverrides} at line 575 passes status: 'all' to the FilterBar, so the dropdown displays "All". But appliedFilters (lines 210-212) still applies restrictedDefaultStatus (ON_HOLD_ADMIN) whenever hasSelectedStatusFilter is false.

This means: user sees "All" → expects all statuses → only sees ON_HOLD_ADMIN results. If they select "Owed", see results, then select "All" expecting to see everything including those Owed payments, they only get ON_HOLD_ADMIN.

Prompt for agents
The root cause is in selectedValueOverrides (line 229) and defaultDropdownValues (line 245). When filters.status is undefined or ['all'] in the restricted approver view, the dropdown shows 'All' but appliedFilters (line 210-212) still sends ON_HOLD_ADMIN to the API.

Two possible fixes depending on the desired UX:

1. If 'All' should truly mean 'all statuses' for restricted approvers: update appliedFilters to NOT inject restrictedDefaultStatus when the user explicitly selects 'All'. This means distinguishing between 'user has not touched the dropdown yet' (apply default) vs 'user chose All' (no status filter). One approach: only apply restrictedDefaultStatus when filters.status is undefined (initial state), but not when it is ['all'] (explicit selection).

2. If ON_HOLD_ADMIN should remain the default and 'All' was never intended to show all statuses: revert the dropdown display for restricted views to show 'ON_HOLD_ADMIN' when no explicit status is chosen. This could be done by restoring the old fallback logic: const statusOverride = filters.status?.[0] ?? restrictedDefaultStatus in selectedValueOverrides, and keeping defaultDropdownValues.status inside the if (!restrictedCategory) block so it doesn't override the restricted view's display.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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