Filter disabled report field values out of the Recent section#94764
Filter disabled report field values out of the Recent section#94764MelvinBot wants to merge 1 commit into
Conversation
Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
@MelvinBot what should happen if I follow the steps listed above, should the list value disappear on device B? |
|
Yes — with both devices online, the value should disappear on device B, and after this PR it disappears from both sections of the open selector. Why: The value list comes from the policy. The Recent section was the gap: it was read straight from the per-user Caveat — offline: if device B is offline when the value is disabled, it won't get the Pusher update, so nothing changes until it reconnects and the policy syncs. That's expected offline-first behavior, not a regression. |
|
@MelvinBot, could you check why it doesn't disappear only at ios native app? |
|
I couldn't reproduce an iOS-only cause from the code — every step of the pipeline that removes a disabled value is platform-agnostic, so this looks like a runtime live-update / re-render difference on iOS native, not a defect in this PR's Recent-filter logic. What I verified is platform-agnostic (no iOS-only branch):
So the break is most likely before the JS re-render — the Two quick checks that would pinpoint it:
If it turns out the fix needs changes in |
Explanation of Change
The value selector for a list report field renders two lists: All (built from
fieldOptions, which the caller already filters to exclude disabled values) and Recent (read straight from the per-userrecentlyUsedReportFieldsOnyx NVP). The Recent source was never cross-checked against the enabled options, so a value that was used on a report and then disabled in workspace settings stayed inrecentlyUsedReportFieldsand kept showing under Recent, while being correctly hidden from All.This fixes it at the single convergence point —
getReportFieldOptionsSection— by intersectingrecentlyUsedOptionswith the (already disabled-filtered)optionsset, so the Recent section can never contain a value that isn't in All:Because
optionsarriving here is already filtered to enabled values, this guarantees Recent ⊆ enabled options with no extra data plumbing. As a bonus, it also drops any stale recent value that was deleted from the field entirely. Filtering at render time (rather than pruning the NVP on disable) is the correct fix becauserecentlyUsedReportFieldsis a per-user NVP — an admin disabling a policy-level value cannot rewrite every member's recent list, so the stale value must be filtered on read.Fixed Issues
$ #94372
PROPOSAL: #94372 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Offline tests
N/A — render-time filtering only.
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionScreenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari