Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(new-chanenls): remove raf, lower buffer (#2162)

teo0bddea71f27b
diff --git a/js/app/packages/channel/Channel/ThreadList.tsx b/js/app/packages/channel/Channel/ThreadList.tsx
index 8c50bc3412..e41a94955a 100644
--- a/js/app/packages/channel/Channel/ThreadList.tsx
+++ b/js/app/packages/channel/Channel/ThreadList.tsx
@@ -6,8 +6,8 @@ import {
type ScrollDirection,
} from '@core/util/scroll-intent';
-const BASE_ITEM_SIZE = 62;
-const BASE_BUFFER_SIZE = BASE_ITEM_SIZE * 10;
+const BASE_ITEM_SIZE: number = 64;
+const BASE_BUFFER_SIZE: number = BASE_ITEM_SIZE;
type ScrollAlignment = ScrollToIndexOpts['align'];
@@ -208,20 +208,19 @@ export function ThreadList(props: ThreadListProps) {
function scrollOnMount(handle: VirtualizerHandle) {
const target = props.initialScrollTarget ?? DEFAULT_INITIAL_SCROLL_TARGET;
- requestAnimationFrame(() => {
- scrollToTarget(handle, target);
- requestAnimationFrame(() => {
- // Run a second pass after layout settles to avoid partial initial anchoring.
- scrollToTarget(handle, target);
- setDidInitialScroll(true);
- emitScrollState(handle, false);
- });
- });
+ scrollToTarget(handle, target);
+ setDidInitialScroll(true);
+ emitScrollState(handle, false);
}
const handleScroll = () => {
const handle = virtualHandle();
- if (!handle) return;
+ if (!handle) {
+ console.warn(
+ 'Channel.ThreadList: handle scroll but the handle is undefined'
+ );
+ return;
+ }
const distanceFromTop = handle.scrollOffset;
const distanceFromBottom =
@@ -288,6 +287,7 @@ export function ThreadList(props: ThreadListProps) {
'flex-direction': 'column',
}}
>
+ <div style={{ 'flex-grow': 1 }} />
<Virtualizer
ref={(ref) => {
if (!ref) return;
diff --git a/js/app/packages/channel/Thread/ChannelThread.tsx b/js/app/packages/channel/Thread/ChannelThread.tsx
index 4b2817f09e..54d495f4c0 100644
--- a/js/app/packages/channel/Thread/ChannelThread.tsx
+++ b/js/app/packages/channel/Thread/ChannelThread.tsx
@@ -26,7 +26,6 @@ export function ChannelThread(props: ThreadProps) {
const thread = () => props.data().thread;
const hasReplies = () => thread().reply_count > 0;
const fetchRepliesEnabled = () => props.data().thread.reply_count > 0;
-
const isSelected = () => props.selectedMessageId?.() === props.data().id;
const repliesQuery = useThreadRepliesQuery(