fix: explore tab first-click navigation and misleading empty state

Clear stale currentChannelId when clicking Explore/DMs in ServerSidebar,
and guard AppLayout route effect from clobbering showExplore. Move member
exclusion into SQL for correct pagination/totals, surface allSettled errors,
and show context-aware empty state messages.
This commit is contained in:
Jannis Braun
2026-03-04 21:24:43 +01:00
parent 5e4a5c2ee9
commit a5ea7633fc
5 changed files with 54 additions and 20 deletions
@@ -183,7 +183,9 @@ export function AppLayout() {
// Handle route params
useEffect(() => {
if (serverId === '@me') {
setShowDms(true);
if (!useUIStore.getState().showExplore) {
setShowDms(true);
}
setCurrentServer(null);
} else if (serverId) {
setShowDms(false);
@@ -124,6 +124,7 @@ export function ServerSidebar() {
const setShowExplore = useUIStore((s) => s.setShowExplore);
const openModal = useUIStore((s) => s.openModal);
const addToast = useUIStore((s) => s.addToast);
const setCurrentChannel = useChatStore((s) => s.setCurrentChannel);
const unreadChannels = useChatStore((s) => s.unreadChannels);
const instances = useInstanceStore((s) => s.instances);
const navigate = useNavigate();
@@ -188,12 +189,14 @@ export function ServerSidebar() {
const handleDmClick = () => {
setShowDms(true);
setCurrentServer(null);
setCurrentChannel(null);
navigate('/channels/@me');
};
const handleExploreClick = () => {
setShowExplore(true);
setCurrentServer(null);
setCurrentChannel(null);
navigate('/channels/@me');
};