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 blanking and weird virtua scroll bug (#2227)
dev-rbf67aa1d1691e
diff --git a/js/app/bun.lock b/js/app/bun.lockindex ddb67421be..c4fa09f19f 100644--- a/js/app/bun.lock+++ b/js/app/bun.lock@@ -94,7 +94,7 @@"ts-pattern": "^5.9.0","unicode-emoji-json": "^0.8.0","uuid": "^10.0.0",- "virtua": "0.48.1",+ "virtua": "0.48.8","vite-plugin-wasm": "^3.5.0","vitest": "^3.2.4","zod": "^3.23.8",@@ -311,7 +311,6 @@"patchedDependencies": {"@kobalte/[email protected]": "patches/@kobalte%[email protected]","@thisbeyond/[email protected]": "patches/@thisbeyond%[email protected]",- "[email protected]": "patches/[email protected]","@lexical/[email protected]": "patches/@lexical%[email protected]","[email protected]": "patches/[email protected]",},@@ -2758,7 +2757,7 @@"verror": ["[email protected]", "", { "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" } }, "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw=="],- "virtua": ["[email protected]", "", { "peerDependencies": { "react": ">=16.14.0", "react-dom": ">=16.14.0", "solid-js": ">=1.0", "svelte": ">=5.0", "vue": ">=3.2" }, "optionalPeers": ["react", "react-dom", "solid-js", "svelte", "vue"] }, "sha512-bjVdaIIc/V1XLjWg17DNRNDO919+9caYdMHTNFaQ9GGSpCv2/b6uH9/IR5BfAQnxBcKpH0kQysZXdLLWN1VULw=="],+ "virtua": ["[email protected]", "", { "peerDependencies": { "react": ">=16.14.0", "react-dom": ">=16.14.0", "solid-js": ">=1.0", "svelte": ">=5.0", "vue": ">=3.2" }, "optionalPeers": ["react", "react-dom", "solid-js", "svelte", "vue"] }, "sha512-jpsxOw5V4B6hg44JePRLo9DL0TV7N1lBEVtPjKpAJebXyhI2s9lfiXJESaLapNtr3vtiSk/pWHiLf7B2a6UcgQ=="],"vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g=="],diff --git a/js/app/package.json b/js/app/package.jsonindex b40b9c878c..6be7f52411 100644--- a/js/app/package.json+++ b/js/app/package.json@@ -111,7 +111,7 @@"ts-pattern": "^5.9.0","unicode-emoji-json": "^0.8.0","uuid": "^10.0.0",- "virtua": "0.48.1",+ "virtua": "0.48.8","vite-plugin-wasm": "^3.5.0","vitest": "^3.2.4","zod": "^3.23.8"@@ -162,8 +162,7 @@"[email protected]": "patches/[email protected]","@thisbeyond/[email protected]": "patches/@thisbeyond%[email protected]","@lexical/[email protected]": "patches/@lexical%[email protected]",- "@kobalte/[email protected]": "patches/@kobalte%[email protected]",- "[email protected]": "patches/[email protected]"+ "@kobalte/[email protected]": "patches/@kobalte%[email protected]"},"overrides": {"cross-spawn": "7.0.6",diff --git a/js/app/packages/block-channel/component/MessageList/MessageList.tsx b/js/app/packages/block-channel/component/MessageList/MessageList.tsxindex 1b75606c86..f71342cf7d 100644--- a/js/app/packages/block-channel/component/MessageList/MessageList.tsx+++ b/js/app/packages/block-channel/component/MessageList/MessageList.tsx@@ -55,7 +55,6 @@ import type { ScrollToIndexOpts } from 'virtua/unstable_core';import { MessageContainer } from '../Message/MessageContainer';import { ReplyInputsPortaler } from '../ReplyInputsPortaler';import type { MessageListContext } from '@block-channel/utils/listContext';-import { match } from 'ts-pattern';false && observedSize;@@ -199,56 +198,9 @@ export function MessageList(props: MessageListProps) {});const getVirtualIndexForMessageId = (messageId: string) => {- const list = topLevelMessages();const topLevelIndex = topLevelIndexByMessageId().get(messageId);if (topLevelIndex === undefined) return undefined;- return list.length - 1 - topLevelIndex;- };-- const scrollElementIntoView = (- targetEl: HTMLElement,- align: ScrollToIndexOpts['align'] = 'nearest'- ) => {- const handle = virtualHandle();- const container = scrollContainerRef();- if (!handle || !container) return;-- const targetBounds = targetEl.getBoundingClientRect();- const containerBounds = container.getBoundingClientRect();- const currentOffset = handle.scrollOffset;-- const visualTop = targetBounds.top - containerBounds.top;- const visualBottom = targetBounds.bottom - containerBounds.top;-- const targetTop = currentOffset + handle.viewportSize - visualTop;- const targetBottom = currentOffset + handle.viewportSize - visualBottom;-- const visibleBottomEdge = currentOffset;- const visibleTopEdge = currentOffset + handle.viewportSize;-- const nextOffset = match(align)- .with('start', () => targetTop - handle.viewportSize)- .with('end', () => targetBottom)- .with('center', () => {- // Center the element in the viewport- const elementCenter = (targetTop + targetBottom) / 2;- return elementCenter - handle.viewportSize / 2;- })- .otherwise(() => {- // 'nearest': only scroll if element is out of view- if (targetTop > visibleTopEdge) {- // Element is above the visible area, scroll up to show it- return targetTop - handle.viewportSize;- } else if (targetBottom < visibleBottomEdge) {- // Element is below the visible area, scroll down to show it- return targetBottom;- }- return undefined;- });-- if (nextOffset !== undefined) {- handle.scrollTo(nextOffset);- }+ return topLevelIndex;};const tryAlignMessageElement = (@@ -262,7 +214,7 @@ export function MessageList(props: MessageListProps) {`[data-message-body-id="${messageId}"]`);if (!targetEl) return false;- scrollElementIntoView(targetEl, align);+ targetEl.scrollIntoView({ block: align });if (focus) targetEl.focus();return true;};@@ -511,7 +463,7 @@ function MessageListImpl(props: MessageListProps) {forceBottom ||((!target || delta > TARGET_MESSAGE_ACTIVE_TIME) && isNearBottom())) {- virtualHandle()?.scrollTo(0);+ virtualHandle()?.scrollBy(Number.MAX_SAFE_INTEGER);return;}@@ -686,7 +638,7 @@ function MessageListImpl(props: MessageListProps) {});const threadRows = mapArray(- () => filteredTopLevelMessages().toReversed(),+ () => filteredTopLevelMessages(),(message) => {const children = () =>(viewThreads[message.id] ?? []).filter(messageFilterFn);@@ -722,7 +674,7 @@ function MessageListImpl(props: MessageListProps) {const msg = list[i];const threadState = listContext.getThreadState(msg.id);if (threadState?.hasActiveReply) {- indices.push(length - 1 - i);+ indices.push(i);}}return indices;@@ -796,6 +748,17 @@ function MessageListImpl(props: MessageListProps) {));+ let mountScrolled = false;+ createEffect(+ on(virtualHandle, (handle) => {+ if (mountScrolled || !handle || props.targetMessage()) return;++ mountScrolled = true;++ scrollToBottomOrTarget({ forceBottom: true });+ })+ );+const [unviewedMessages, setUnviewedMessages] = createSignal<Message[]>();const [dismissUnviewedMessages, setDismissUnviewedMessages] =createSignal(false);@@ -1043,7 +1006,6 @@ function MessageListImpl(props: MessageListProps) {'overflow-y': 'scroll','overflow-anchor': 'none',display: 'flex',- 'flex-direction': 'column-reverse',}}class="scrollbar-hidden [&>div]:mb-auto"data-channel-message-list@@ -1100,7 +1062,6 @@ function MessageListImpl(props: MessageListProps) {/></Show><CustomScrollbar- reversescrollContainer={listContext.scrollContainerRef}enabled={hasUserScrolled()}/>