From 748e011f87f47de8d375e1dc761ed922345c5d5e Mon Sep 17 00:00:00 2001 From: Deepak Bhagat Date: Sun, 4 Jan 2026 23:20:19 +0530 Subject: [PATCH 1/2] fix: reset total state when switching directory filters 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. --- app/views/DirectoryView/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/DirectoryView/index.tsx b/app/views/DirectoryView/index.tsx index e827e732c50..5315d790716 100644 --- a/app/views/DirectoryView/index.tsx +++ b/app/views/DirectoryView/index.tsx @@ -150,7 +150,7 @@ class DirectoryView extends React.Component { - this.setState({ type, data: [] }, () => this.search()); + this.setState({ type, data: [], total: -1 }, () => this.search()); if (type === 'users') { logEvent(events.DIRECTORY_SEARCH_USERS); @@ -164,7 +164,7 @@ class DirectoryView extends React.Component { this.setState( - ({ globalUsers }) => ({ globalUsers: !globalUsers, data: [] }), + ({ globalUsers }) => ({ globalUsers: !globalUsers, data: [], total: -1 }), () => this.search() ); }; From 870fd11427718069d67f9830a51a89c0e7dcf678 Mon Sep 17 00:00:00 2001 From: Deepak Bhagat Date: Mon, 5 Jan 2026 21:49:56 +0530 Subject: [PATCH 2/2] fix: cancel pending debounced calls when switching filters --- app/views/DirectoryView/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/DirectoryView/index.tsx b/app/views/DirectoryView/index.tsx index 5315d790716..d4611f9d01e 100644 --- a/app/views/DirectoryView/index.tsx +++ b/app/views/DirectoryView/index.tsx @@ -150,6 +150,7 @@ class DirectoryView extends React.Component { + this.load.stop(); this.setState({ type, data: [], total: -1 }, () => this.search()); if (type === 'users') { @@ -163,6 +164,7 @@ class DirectoryView extends React.Component { + this.load.stop(); this.setState( ({ globalUsers }) => ({ globalUsers: !globalUsers, data: [], total: -1 }), () => this.search()