Skip to content

[CP Staging] Revert "fix: handle selection mode in search context"#73107

Merged
blimpich merged 1 commit into
mainfrom
revert-71700-fix/69251
Oct 21, 2025
Merged

[CP Staging] Revert "fix: handle selection mode in search context"#73107
blimpich merged 1 commit into
mainfrom
revert-71700-fix/69251

Conversation

@lakchote

@lakchote lakchote commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

Reverts #71700

Fixes
$ #73089

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @lakchote has triggered a test Expensify/App build. You can view the workflow run here.

@codecov

codecov Bot commented Oct 21, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/components/MoneyReportHeader.tsx 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/components/Search/SearchContext.tsx 25.00% <ø> (-1.54%) ⬇️
src/components/SelectionListWithModal/index.tsx 92.59% <100.00%> (+5.09%) ⬆️
src/components/MoneyReportHeader.tsx 0.18% <0.00%> (ø)

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
Built from App PR #73107.

Android 🤖 iOS 🍎
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/73107/index.html ⏩ SKIPPED ⏩
Android The build for iOS was skipped
Desktop 💻 Web 🕸️
⏩ SKIPPED ⏩ ⏩ SKIPPED ⏩
The build for Desktop was skipped The build for Web was skipped

👀 View the workflow run that generated this build 👀

@kavimuru

Copy link
Copy Markdown

@lakchote @blimpich Not reproducible in the ad hoc build

Screen_Recording_20251021_190738_Expensify.Adhoc.mp4

@blimpich blimpich marked this pull request as ready for review October 21, 2025 17:07
@blimpich blimpich requested a review from a team as a code owner October 21, 2025 17:07
@blimpich blimpich merged commit 90739aa into main Oct 21, 2025
28 of 30 checks passed
@blimpich blimpich deleted the revert-71700-fix/69251 branch October 21, 2025 17:07
@melvin-bot melvin-bot Bot added the Emergency label Oct 21, 2025
@melvin-bot

melvin-bot Bot commented Oct 21, 2025

Copy link
Copy Markdown

@blimpich looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@melvin-bot melvin-bot Bot requested a review from chuckdries October 21, 2025 17:08
@melvin-bot

melvin-bot Bot commented Oct 21, 2025

Copy link
Copy Markdown

@chuckdries Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot removed the request for review from a team October 21, 2025 17:08
@blimpich

Copy link
Copy Markdown
Contributor

Not an emergency, straight revert to fix a deploy blocker

turnOffMobileSelectionMode();
}
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [sections, selectedItemsProp, isMobileSelectionModeEnabled, isSmallScreenWidth, isSelected, isFocused]);

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.

❌ PERF-6 (docs)

The sections array is included as a dependency, which could cause unnecessary re-executions of this effect whenever any property in any section changes, even if unrelated to selection logic.

Consider extracting specific properties that are actually used:

const selectedItems = useMemo(() => 
    selectedItemsProp ?? 
    sections[0].data.filter((item) => {
        if (isSelected) {
            return isSelected(item);
        }
        return !!item.isSelected;
    }), [selectedItemsProp, sections[0].data, isSelected]
);

useEffect(() => {
    // ... rest of logic
}, [selectedItems.length, isMobileSelectionModeEnabled, isSmallScreenWidth, isFocused]);

// We can access 0 index safely as we are not displaying multiple sections in table view
const selectedItems =
selectedItemsProp ??
sections[0].data.filter((item) => {

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.

❌ Array Index Access Without Bounds Check

Accessing sections[0].data without checking if sections array is non-empty could cause a runtime error if sections is empty.

Add a bounds check:

const selectedItems =
    selectedItemsProp ??
    (sections.length > 0 ? sections[0].data.filter((item) => {
        if (isSelected) {
            return isSelected(item);
        }
        return !!item.isSelected;
    }) : []);

}, []);

if (isMobileSelectionModeEnabled && shouldUseNarrowLayout) {
if (isMobileSelectionModeEnabled) {

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.

❌ Logic Issue: Condition Removal May Cause Unintended Behavior

The removed && shouldUseNarrowLayout condition means the mobile selection mode logic will now execute on all screen sizes, not just narrow layouts. This could cause selection mode to be unexpectedly turned off on larger screens where it shouldn't apply.

Consider if this change is intentional. If mobile selection mode should only apply to narrow layouts, the condition should be restored:

if (isMobileSelectionModeEnabled && shouldUseNarrowLayout) {

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@blimpich blimpich changed the title Revert "fix: handle selection mode in search context" [CP Staging] Revert "fix: handle selection mode in search context" Oct 21, 2025
OSBotify pushed a commit that referenced this pull request Oct 21, 2025
(cherry picked from commit 90739aa)

(cherry-picked to staging by blimpich)
@OSBotify OSBotify added the CP Staging marks PRs that have been CP'd to staging label Oct 21, 2025
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/blimpich in version: 9.2.35-3 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.2.35-4 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/blimpich in version: 9.2.36-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/lakchote in version: 9.2.36-7 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants