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.

fix(channels): scroll-to-bottom hotkey to use dedicated handler (#3330)

teo3e194207d43f
diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsx
index 0125624614..e93c2bab0a 100644
--- a/js/app/packages/channel/Channel/Channel.tsx
+++ b/js/app/packages/channel/Channel/Channel.tsx
@@ -319,6 +319,16 @@ export function Channel(props: ChannelProps) {
isMessageLoaded: (id) => messageIndex.keys.includes(id),
});
+ const handleScrollToBottom = () => {
+ if (messagesQuery.hasPreviousPage) {
+ targetMessageController.reset();
+ const defaultKey = getChannelMessagesQueryKey(props.channelId, null);
+ queryClient.resetQueries({ queryKey: defaultKey });
+ } else {
+ threadListNavigation()?.scrollToBottom('end');
+ }
+ };
+
const { messageListScopeId, attachMessageListRef, attachInputRef } =
createChannelHotkeys({
selection,
@@ -330,18 +340,9 @@ export function Channel(props: ChannelProps) {
isInputEmpty: () =>
(channelInputSnapshot()?.value.trim().length ?? 0) === 0,
onOpenFindBar: findBar.open,
+ onGoToBottom: handleScrollToBottom,
});
- const handleScrollToBottom = () => {
- if (messagesQuery.hasPreviousPage) {
- targetMessageController.reset();
- const defaultKey = getChannelMessagesQueryKey(props.channelId, null);
- queryClient.resetQueries({ queryKey: defaultKey });
- } else {
- threadListNavigation()?.scrollToBottom('end');
- }
- };
-
createStickyScrollEffect({
isNearBottom: () => threadListScrollState()?.isNearBottom ?? false,
hasMoreBelow: () => threadPaginator.hasMorePrepend(),
diff --git a/js/app/packages/channel/Channel/create-channel-hotkeys.ts b/js/app/packages/channel/Channel/create-channel-hotkeys.ts
index a2d9789bce..ea9f1f5a47 100644
--- a/js/app/packages/channel/Channel/create-channel-hotkeys.ts
+++ b/js/app/packages/channel/Channel/create-channel-hotkeys.ts
@@ -15,6 +15,7 @@ type CreateChannelHotkeysOptions = {
isInputEmpty: Accessor<boolean>;
isEditing: Accessor<boolean>;
onOpenFindBar: () => void;
+ onGoToBottom: () => void;
};
export function canReplyToSelectedMessageFromHotkey(input: {
@@ -90,10 +91,8 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
description: 'Go to latest message',
keyDownHandler: () => {
options.selection.clear();
- const id = options.selection.selectPrevious();
- if (!id) return false;
options.navigation()?.markUserIntent('down');
- options.navigation()?.scrollToId(id, { align: 'end' });
+ options.onGoToBottom();
return true;
},
});