Keep workspace filter visible during hydration

This commit is contained in:
Jinwoo-H
2026-08-14 17:00:12 -04:00
parent 9bb8836bb6
commit cb1f87d307
2 changed files with 14 additions and 2 deletions
@@ -36,6 +36,7 @@ function setState(overrides: Record<string, unknown> = {}): void {
hideWorkspacesFromOtherDevices: false,
setHideWorkspacesFromOtherDevices: vi.fn(),
runtimeEnvironments: [],
runtimeEnvironmentCatalogHydrated: true,
alwaysShowDefaultBranchWorkspace: true,
setAlwaysShowDefaultBranchWorkspace: vi.fn(),
...overrides
@@ -96,8 +97,15 @@ describe('SidebarWorkspaceFilterSection', () => {
expect(rowLabels()).toContain('Hide other-client workspaces')
})
it('keeps the other-client filter visible while the remote catalog loads', () => {
setState({ runtimeEnvironmentCatalogHydrated: false })
render()
expect(rowLabels()).toContain('Hide other-client workspaces')
})
it('hides the other-client filter for local-only clients', () => {
setState()
setState({ runtimeEnvironmentCatalogHydrated: true })
render()
expect(rowLabels()).not.toContain('Hide other-client workspaces')
@@ -27,11 +27,15 @@ const SidebarWorkspaceFilterSection = React.memo(function SidebarWorkspaceFilter
const hideWorkspacesFromOtherDevices = useAppStore((s) => s.hideWorkspacesFromOtherDevices)
const setHideWorkspacesFromOtherDevices = useAppStore((s) => s.setHideWorkspacesFromOtherDevices)
const runtimeEnvironments = useAppStore((s) => s.runtimeEnvironments)
const runtimeEnvironmentCatalogHydrated = useAppStore((s) => s.runtimeEnvironmentCatalogHydrated)
const alwaysShowDefaultBranchWorkspace = useAppStore((s) => s.alwaysShowDefaultBranchWorkspace)
const setAlwaysShowDefaultBranchWorkspace = useAppStore(
(s) => s.setAlwaysShowDefaultBranchWorkspace
)
const showOtherClientFilter = runtimeEnvironments.length > 0 || hideWorkspacesFromOtherDevices
const showOtherClientFilter =
!runtimeEnvironmentCatalogHydrated ||
runtimeEnvironments.length > 0 ||
hideWorkspacesFromOtherDevices
return (
<>