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
feat(channels): infinite stale time, on mount hydration (#1364)
teo675a814a8082
diff --git a/js/app/packages/block-channel/component/Channel.tsx b/js/app/packages/block-channel/component/Channel.tsxindex 505d9d2046..f527b00aef 100644--- a/js/app/packages/block-channel/component/Channel.tsx+++ b/js/app/packages/block-channel/component/Channel.tsx@@ -56,6 +56,11 @@ import {import { Top } from './Top';import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';import { useChannelContext } from '@block-channel/hooks/channel';+import { FloatingInputLoader } from '@core/component/FloatingInputLoader';+import {+ invalidateChannelWithID,+ useChannelQuery,+} from '@queries/channel/channel';false && fileFolderDrop;@@ -83,6 +88,7 @@ export function Channel(props: {const [_activeThreadId, setActiveThreadId] = activeThreadIdSignal;const channelContext = useChannelContext();+ const channelQuery = useChannelQuery(() => props.channelId);const latestActivity = useChannelActivity(props.channelId);const [openedChannel, setOpenedChannel] = createSignal<Date>();@@ -165,6 +171,12 @@ export function Channel(props: {updateActivityOnOpen();track(TrackingEvents.BLOCKCHANNEL.CHANNEL.OPEN);++ const STALE_THRESHOLD_MS = 1_000;+ const age = Date.now() - channelQuery.dataUpdatedAt;+ if (age > STALE_THRESHOLD_MS) {+ invalidateChannelWithID(props.channelId);+ }});createChannelTrackingEffect(props.channelId);@@ -407,6 +419,13 @@ export function Channel(props: {use:droppableref={containerRef}/>+ <FloatingInputLoader+ minShowTime={200}+ successDuration={100}+ isLoading={() => channelQuery.isFetching}+ loadingText="Refreshing messages"+ class="top-0 bottom-auto mt-2 mb-0 z-10"+ /><MessageListchannelId={props.channelId}messages={channelContext.messages()}diff --git a/js/app/packages/core/component/FloatingInputLoader.tsx b/js/app/packages/core/component/FloatingInputLoader.tsxindex 11c1a9e0e1..d38a53d3ab 100644--- a/js/app/packages/core/component/FloatingInputLoader.tsx+++ b/js/app/packages/core/component/FloatingInputLoader.tsx@@ -26,7 +26,6 @@ export function FloatingInputLoader(props: FloatingInputLoaderProps) {const successDuration = props.successDuration ?? 500;const [loaderState, setLoaderState] = createSignal<LoaderState>('hidden');- // Track what content to display - keeps showing success during fade-outconst [displayState, setDisplayState] = createSignal<'loading' | 'success'>('loading');@@ -47,7 +46,6 @@ export function FloatingInputLoader(props: FloatingInputLoaderProps) {onCleanup(clearTimeouts);- // Use on() to only react to isLoading changes, not loaderState changescreateEffect(on(() => props.isLoading(),@@ -69,7 +67,6 @@ export function FloatingInputLoader(props: FloatingInputLoaderProps) {setDisplayState('success');setLoaderState('success');successTimeoutId = setTimeout(() => {- // Keep displayState as 'success' during fade-out to prevent flashsetLoaderState('hidden');loadingStartTime = null;}, successDuration);diff --git a/js/app/packages/queries/channel/channel.ts b/js/app/packages/queries/channel/channel.tsindex ff26b300df..1e0618944b 100644--- a/js/app/packages/queries/channel/channel.ts+++ b/js/app/packages/queries/channel/channel.ts@@ -38,7 +38,7 @@ export function channelQueryOptions(channelId: string): ChannelQueryOptions {return result;},- staleTime: 0,+ staleTime: Infinity,};}