Expensify Search Bug: Wrong Redirect With Type:chat

by Luna Greco 52 views

Hey guys! We've got a quirky issue in Expensify that I wanted to break down. When searching using the type:chat query, users are sometimes getting redirected to the Reports/Expenses category instead of the expected Reports/Chats. Let's dive into the details and see what's up!

What's the Deal?

This issue is popping up in Expensify, specifically within the app. If you're new around here, Expensify is awesome, but like any app, it has its little quirks. If you're looking to contribute, check out the contributing guidelines and maybe even join the Slack channel. We're always looking for fresh minds!

The Technical Stuff

  • Version Number: 9.1.89-1
  • Reproducible in Staging?: Yes
  • Reproducible in Production?: No
  • Regression Test: This was caught during regression testing. You can check out the test case here.
  • Reported By: Applause Internal Team
  • Devices Affected: Web Chrome, mWeb Safari, iOS
  • App Component: Search

Steps to Replicate

To see this in action, follow these steps:

  1. Sign in to ND: Log into your Expensify account.
  2. Create a Chat: Start a new chat and send a message, like a simple "Hello."
  3. Click the Search Icon: Head to the top right corner and hit that search icon.
  4. Search in Current Conversation: Choose to search within the current chat, type "Hello," and press Enter.

What Should Happen (Expected Result)

Ideally, the app should navigate you to Reports/Chats with the search results displayed neatly. You know, like it should!

What Actually Happens (Actual Result)

Instead, the user is initially redirected to Reports/Expenses after the first search attempt in the chat. It’s like taking a wrong turn! The search query might eventually work after 2-3 tries, but that's not ideal, right? Plus, the queries type:invoice and type:expense are also acting up, failing to show results on the first attempt.

It seems we've got a bit of an inconsistent search behavior going on here. This is definitely not the user experience we're aiming for.

Is There a Quick Fix? (Workaround)

Unfortunately, there's no known workaround at the moment. So, we're stuck with this little glitch until we squash it.

Platforms Affected

This issue isn't playing favorites; it's hitting multiple platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [x] iOS: App
  • [x] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Visual Evidence (Screenshots/Videos)

Check out these visuals to see the issue in action:

https://github.com/user-attachments/assets/43eb7e12-e3a2-446b-a3e2-6f4aff1b5de2

https://github.com/user-attachments/assets/ca7f2cb2-0088-467e-9f71-d478aefcd071

Why This Matters

Search functionality is crucial for user experience. When users can't reliably find what they're looking for, frustration kicks in. A broken search can lead to:

  • Lost Productivity: Users spend more time hunting for information.
  • Decreased User Satisfaction: A frustrating experience can make users less likely to use the app.
  • Potential Errors: If users can't find the right information, they might make mistakes.

The inconsistency with type:invoice and type:expense queries adds another layer of complexity. It suggests there might be a deeper issue with how search queries are being processed and routed within the app. This kind of bug can erode trust in the app's functionality, making it imperative to address swiftly.

Possible Causes

Let's brainstorm some potential reasons for this misdirection:

  • Routing Logic: There could be a flaw in the routing logic that handles search queries, especially those with type: filters. The app might be misinterpreting the query or failing to properly direct the user to the correct category.
  • Indexing Issues: The search index might not be up-to-date or properly configured. This could lead to the app showing incorrect or incomplete results, or even misdirecting the user to the wrong section.
  • Caching Problems: Caching mechanisms, while designed to improve performance, can sometimes cause issues. If the app is caching outdated search results or routing information, it could explain why the correct results only appear after multiple attempts.
  • Asynchronous Operations: Search operations often involve asynchronous processes. If these processes aren't properly synchronized, it could lead to race conditions where the app navigates the user before the search results are fully processed.
  • API Glitches: There might be issues with the API endpoints responsible for handling search queries. If these endpoints are experiencing intermittent problems, it could lead to inconsistent search behavior.

How We Can Fix It

To tackle this, we need a multi-pronged approach:

  1. Detailed Debugging: The developers need to dive deep into the codebase and debug the search functionality. This involves tracing the flow of the search query, examining the routing logic, and checking for any errors or inconsistencies.
  2. Index Review: We should review the search index to ensure it's properly configured and up-to-date. This includes checking for any indexing errors and optimizing the index for performance.
  3. Caching Audit: A thorough audit of the caching mechanisms is necessary. We need to ensure that the app is caching the correct data and that the cache is being properly invalidated when changes occur.
  4. Asynchronous Process Management: We should review the handling of asynchronous operations to ensure they are properly synchronized. This might involve implementing additional error handling and synchronization mechanisms.
  5. API Endpoint Monitoring: We need to closely monitor the API endpoints responsible for search queries. This includes tracking response times, error rates, and any other relevant metrics. If issues are detected, we need to investigate and address them promptly.

Open Jobs

If you're interested in helping out, you can view all open jobs on GitHub.

Let's get this search functionality back on track! A smooth search experience is key to a happy user base.