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(channel): Opening message from popup preview not flashing message (#1096)

dev-rb3e6fb418f2f7
diff --git a/js/app/packages/app/component/soupContextHelpers.ts b/js/app/packages/app/component/soupContextHelpers.ts
index 2e1396a71e..2c93a08df0 100644
--- a/js/app/packages/app/component/soupContextHelpers.ts
+++ b/js/app/packages/app/component/soupContextHelpers.ts
@@ -1,4 +1,3 @@
-import type { BlockChannelProps } from '@block-channel/component/Block';
import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';
import { URL_PARAMS as EMAIL_PARAMS } from '@block-email/constants';
import { URL_PARAMS as MD_PARAMS } from '@block-md/constants';
@@ -73,12 +72,10 @@ export const openEntityInSplitFromUnifiedList = async (
// Build params for channel entities with location
const params =
entity.type === 'channel' && location?.type === 'channel'
- ? ({
- target: {
- threadId: location.threadId,
- messageId: location.messageId,
- },
- } as BlockChannelProps)
+ ? {
+ [CHANNEL_PARAMS.message]: location.messageId,
+ [CHANNEL_PARAMS.thread]: location.threadId,
+ }
: undefined;
// Create or replace split based on openInNewSplit option
diff --git a/js/app/packages/block-channel/component/Block.tsx b/js/app/packages/block-channel/component/Block.tsx
index a6ff6313c1..bc2ffaf22c 100644
--- a/js/app/packages/block-channel/component/Block.tsx
+++ b/js/app/packages/block-channel/component/Block.tsx
@@ -18,7 +18,8 @@ import {
} from 'solid-js';
import { Channel } from './Channel';
import { JoinChannelDialog } from './JoinChannelDialog';
-import type { TargetMessageInfo } from './MessageList/MessageList';
+import { URL_PARAMS } from '@block-channel/constants';
+import type { TargetMessageInfo } from '@block-channel/component/MessageList/MessageList';
export function WithTopBar(props: { children: JSXElement }) {
return <div>{props.children}</div>;
@@ -26,9 +27,9 @@ export function WithTopBar(props: { children: JSXElement }) {
export type JoinState = 'REQUIRED' | 'NOT_REQUIRED';
-export type BlockChannelProps = {
- target?: TargetMessageInfo;
-};
+type IncomingParams = Record<string, string>;
+
+export type BlockChannelProps = IncomingParams & {};
export default function BlockChannel(props: BlockChannelProps) {
const channelId = useBlockId();
@@ -94,6 +95,17 @@ export default function BlockChannel(props: BlockChannelProps) {
return maybeChannelName();
};
+ const targetMessage = () => {
+ const messageID = props[URL_PARAMS.message];
+ if (!messageID) return;
+ const threadID = props[URL_PARAMS.thread];
+
+ return {
+ messageId: messageID,
+ threadId: threadID,
+ } satisfies TargetMessageInfo;
+ };
+
return (
<Suspense>
<DocumentBlockContainer title={channelName() ?? 'Channel'}>
@@ -124,7 +136,7 @@ export default function BlockChannel(props: BlockChannelProps) {
</Match>
<Match when={validChannelData()}>
{(channelData) => (
- <Channel data={channelData()} target={props.target} />
+ <Channel data={channelData()} target={targetMessage()} />
)}
</Match>
</Switch>