Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(channels): open Chat sidebar search without crashing the rail (#9835)
Peter Chinman7f13a9145658
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsxindex 44b70d92b9..2b3f4ed547 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx@@ -639,6 +639,56 @@ it.each(['team_channels', 'channels'] as const)(});+it('opens search over mounted section rows', async () => {+ mocks.realRenderer = true;+ vi.spyOn(HTMLElement.prototype, 'offsetParent', 'get').mockImplementation(+ function (this: HTMLElement) {+ return this.parentElement;+ }+ );+ vi.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(+ function (this: HTMLElement) {+ return this.hasAttribute('data-index') ? 34 : 200;+ }+ );+ vi.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(300);+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ }+ );+ const [searchOpen, setSearchOpen] = createSignal(false);+ render(() => (+ <ChannelsRail+ sources={{+ ...sources,+ team_channels: { ...source, items: () => [] },+ direct_messages: { ...source, items: () => [] },+ search: {+ ...source,+ items: () => [{ ...channel, id: 'found', name: 'Found' }],+ },+ }}+ searchQuery=""+ onSearchQueryChange={() => {}}+ searchOpen={searchOpen()}+ onSearchOpenChange={setSearchOpen}+ />+ ));+ await Promise.resolve();+ expect(screen.getByRole('button', { name: 'One' })).toBeTruthy();++ // Disposing the section rows must not rerun the sections being disposed.+ expect(() => setSearchOpen(true)).not.toThrow();+ await Promise.resolve();++ expect(screen.getByRole('button', { name: 'Found' })).toBeTruthy();+ expect(screen.queryByRole('button', { name: 'One' })).toBeNull();+});+describe('section heading navigation', () => {it.each([['label:first', ']', 'label:second'],diff --git a/apps/web/src/features/channels-view/components/rail/next/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/next/ExpandedChannelsRail.tsxindex a9779d8060..a5263e9897 100644--- a/apps/web/src/features/channels-view/components/rail/next/ExpandedChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/next/ExpandedChannelsRail.tsx@@ -560,9 +560,14 @@ function BrowseSection(props: {<ChannelRailVirtualizerref={(current) => {handle.virtualizer = current;- handle.outerScroll = outerScroll();setVirtualizer(current);- if (current) props.onReady();+ // The virtualizer clears its ref while the rail is disposed. A+ // reactive read then can rerun the owner being disposed, so keep+ // the last snapshot.+ if (!current) return;++ handle.outerScroll = outerScroll();+ props.onReady();}}keys={rowIds()}scrollRoot={rowsScrollRoot()}