Skip to content

Conversation

@deepak0x
Copy link

@deepak0x deepak0x commented Jan 4, 2026

Fixed issue where switching from empty teams filter to users or channels would show empty results. The problem was that changeType and toggleWorkspace were only resetting data array but not the total count, causing the load logic to think all data was already loaded.

Now both data and total are reset when switching filters, ensuring proper state cleanup before new searches.

Closes #6879

Before (Issue)

before.mov

After (Fix)

after.mov

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Improved state management when changing directory filters and workspace view options to ensure data resets properly and searches execute correctly.

✏️ Tip: You can customize this high-level summary in your review settings.

Fixed issue where switching from empty teams filter to users or channels
would show empty results. The problem was that changeType and toggleWorkspace
were only resetting data array but not the total count, causing the load
logic to think all data was already loaded.

Now both data and total are reset when switching filters, ensuring proper
state cleanup before new searches.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

Walkthrough

The DirectoryView now stops any ongoing load and resets search state (clears data and sets total to -1) before changing type or toggling global/workspace, then triggers a fresh search to avoid stale empty results.

Changes

Cohort / File(s) Summary
DirectoryView Search State Reset
app/views/DirectoryView/index.tsx
Stops running load before updates; on type change or workspace/global toggle it sets type, flips globalUsers when toggling, clears data (to []), sets total to -1, and triggers a new search.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I stopped the old load, then cleared the trail,
Switched types and toggles on a fresh new gale,
Data wiped to zero, total set to -1,
Hop—search restarts, and the results come run! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: resetting total state when switching directory filters, which directly addresses the linked issue.
Linked Issues check ✅ Passed The code changes reset both data and total state in changeType and toggleWorkspace functions, directly addressing the root cause described in issue #6879.
Out of Scope Changes check ✅ Passed The changes are focused and scoped to DirectoryView state management for filter switching, with no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 748e011 and 870fd11.

📒 Files selected for processing (1)
  • app/views/DirectoryView/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/views/DirectoryView/index.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepak0x deepak0x requested a deployment to approve_e2e_testing January 5, 2026 13:39 — with GitHub Actions Waiting
@deepak0x deepak0x requested a deployment to official_android_build January 5, 2026 13:43 — with GitHub Actions Waiting
@deepak0x deepak0x requested a deployment to official_ios_build January 5, 2026 13:43 — with GitHub Actions Waiting
@deepak0x deepak0x requested a deployment to experimental_ios_build January 5, 2026 13:43 — with GitHub Actions Waiting
@deepak0x deepak0x requested a deployment to experimental_android_build January 5, 2026 13:43 — with GitHub Actions Waiting
Copy link
Contributor

@OtavioStasiak OtavioStasiak left a comment

Choose a reason for hiding this comment

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

The main problem is that when you click to change the filter, sometimes newSearch is triggered as false. This is probably related to the debounce, so you should investigate it to really fix the root cause.

@deepak0x
Copy link
Author

deepak0x commented Jan 5, 2026

ok checking again...

@deepak0x deepak0x requested a review from OtavioStasiak January 5, 2026 16:21
@deepak0x
Copy link
Author

deepak0x commented Jan 6, 2026

@OtavioStasiak can u pls review again have addressed your changes...

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.

bug: directory view shows empty results when switching from empty Teams filter to Users or Channels

2 participants