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(soup): various bugs (#1435)
dev-rbcd3b4ddc7d0a
diff --git a/js/app/packages/app/component/GlobalHotkeys.tsx b/js/app/packages/app/component/GlobalHotkeys.tsxindex dc56796c04..5cfb12552b 100644--- a/js/app/packages/app/component/GlobalHotkeys.tsx+++ b/js/app/packages/app/component/GlobalHotkeys.tsx@@ -106,22 +106,26 @@ export default function GlobalShortcuts() {});const { openWithSplit } = useSplitLayout();++ const createNewSplit = () => {+ openWithSplit(+ { type: 'component', id: 'unified-list' },+ {+ referredFrom: 'hotkey',+ allowDuplicate: true,+ preferNewSplit: true,+ }+ );+ return true;+ };+registerHotkey({hotkeyToken: TOKENS.global.createNewSplit,hotkey: 'cmd+\\',scopeId: 'global',description: 'Create new split',condition: canFit,- keyDownHandler: () => {- openWithSplit(- { type: 'component', id: 'unified-list' },- {- referredFrom: 'hotkey',- allowDuplicate: true,- }- );- return true;- },+ keyDownHandler: createNewSplit,runWithInputFocused: true,});@@ -130,16 +134,7 @@ export default function GlobalShortcuts() {scopeId: 'global',description: 'Create new split',condition: canFit,- keyDownHandler: () => {- openWithSplit(- { type: 'component', id: 'unified-list' },- {- referredFrom: 'hotkey',- allowDuplicate: true,- }- );- return true;- },+ keyDownHandler: createNewSplit,});registerHotkey({diff --git a/js/app/packages/app/component/PreviewPanel.tsx b/js/app/packages/app/component/PreviewPanel.tsxindex 91786a0c85..fc9f137104 100644--- a/js/app/packages/app/component/PreviewPanel.tsx+++ b/js/app/packages/app/component/PreviewPanel.tsx@@ -17,6 +17,7 @@ import {import { useSplitPanelOrThrow } from './split-layout/layoutUtils';import { Suspense } from 'solid-js';import { createContextProvider } from '@solid-primitives/context';+import { throttledDependent } from '@core/util/debounce';export const [PreviewPanelContext, useMaybePreviewPanel] =createContextProvider(@@ -54,6 +55,11 @@ const PreviewPanelContent: Component<NonNullableFields<PreviewPanel>> = (scopedSplitPanelContextType.previewState = [previewState, setPreviewState];}+ const throttledSelectedEntity = throttledDependent(+ () => props.selectedEntity,+ 150+ );+const blockInstance = () => {const aliasContext = isTaskEntity(props.selectedEntity)? ({@@ -151,7 +157,7 @@ const PreviewPanelContent: Component<NonNullableFields<PreviewPanel>> = (}}><PreviewPanelContext- previewEntity={props.selectedEntity}+ previewEntity={throttledSelectedEntity()}onFocusOut={props.onFocusOut}><Suspense>diff --git a/js/app/packages/app/component/next-soup/filters/filters.ts b/js/app/packages/app/component/next-soup/filters/filters.tsindex e758529c65..939986c253 100644--- a/js/app/packages/app/component/next-soup/filters/filters.ts+++ b/js/app/packages/app/component/next-soup/filters/filters.ts@@ -274,7 +274,7 @@ export const getFolderFileTypes = (type: 'soup' | 'search') => {});};-const NIL_UUID = '00000000-0000-0000-0000-000000000000';+export const NIL_UUID = '00000000-0000-0000-0000-000000000000';const buildDefaultValue = (entityTypes: string[], required: string[]) => {const hasNoEntityTypes = entityTypes.length === 0;diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsxindex 95c044aa95..8401a982a1 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx@@ -228,8 +228,7 @@ export const SoupViewContextProvider: FlowComponent<() => ({params: {limit: 100,- sort_method:- (soup.sort.active()[0]?.id as 'updated_at') ?? 'updated_at',+ sort_method: soup.sort.active()[0]?.id ?? 'updated_at',},body: queryFilters(),}),diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsxindex 29671cff0d..64715fe02a 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx@@ -227,6 +227,7 @@ export const SoupViewList = (props: SoupViewListProps) => {useSoupNavigationHotkeys({scopeId: scopeId(),soup,+ splitHandle: panel.handle,virtualizerHandle,previewPanelRef,});@@ -667,7 +668,7 @@ export const SoupViewList = (props: SoupViewListProps) => {onClear={soup.selection.clear}/></Show>- <Show when={soup.previewEntity()}>+ <Show when={soup.previewEntity() || panel.previewState[0]()}><PreviewPanelref={setPreviewPanelRef}selectedEntity={soup.focus.item()}diff --git a/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts b/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.tsindex 18b4698270..be3b56946d 100644--- a/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts+++ b/js/app/packages/app/component/next-soup/soup-view/use-soup-navigation-hotkeys.ts@@ -4,6 +4,9 @@ import type { Accessor } from 'solid-js';import type { SoupState } from '../create-soup-state';import { useMaybePreviewPanel } from '@app/component/PreviewPanel';import { registerHotkey } from '@core/hotkey/hotkeys';+import type { SplitHandle } from '@app/component/split-layout/layoutManager';+import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';+import type { EntityData } from '@entity';const DEFAULT_ENTITY_SIZE = 40;const CONTEXT_ENTITIES_COUNT = 3;@@ -13,6 +16,7 @@ const CONTEXT_OFFSET = DEFAULT_ENTITY_SIZE * CONTEXT_ENTITIES_COUNT;type UseSoupNavigationHotkeysOptions = {scopeId: string;soup: SoupState;+ splitHandle: SplitHandle;virtualizerHandle: Accessor<VirtualizerHandle | undefined>;previewPanelRef: Accessor<HTMLElement | undefined>;};@@ -20,7 +24,7 @@ type UseSoupNavigationHotkeysOptions = {export const useSoupNavigationHotkeys = (options: UseSoupNavigationHotkeysOptions) => {- const { scopeId, soup, virtualizerHandle } = options;+ const { scopeId, soup, splitHandle, virtualizerHandle } = options;const scrollTo = (index: number) => {const handle = virtualizerHandle();@@ -45,6 +49,16 @@ export const useSoupNavigationHotkeys = (});};+ const openEntity = (entity: EntityData) => {+ const handleContent = splitHandle.content().type;++ if (handleContent === 'component' || handleContent === 'project') return;++ openEntityInSplitFromUnifiedList(entity, {+ splitHandle,+ });+ };+const navigateAndSelectEntity = (offset: number) => {const nextRow = soup.navigate.by(offset);if (!nextRow) return true;@@ -105,6 +119,7 @@ export const useSoupNavigationHotkeys = (if (!next) return true;scrollTo(next.index);+ openEntity(next.item);return true;},@@ -123,6 +138,7 @@ export const useSoupNavigationHotkeys = (if (!next) return true;scrollTo(next.index);+ openEntity(next.item);return true;},diff --git a/js/app/packages/block-project/component/Block.tsx b/js/app/packages/block-project/component/Block.tsxindex 4d1e9745cc..bafbbca60b 100644--- a/js/app/packages/block-project/component/Block.tsx+++ b/js/app/packages/block-project/component/Block.tsx@@ -1,8 +1,4 @@-import { useGlobalBlockOrchestrator } from '@app/component/GlobalAppState';-import {- PreviewPanel,- useMaybePreviewPanel,-} from '@app/component/PreviewPanel';+import { useMaybePreviewPanel } from '@app/component/PreviewPanel';import { SplitPanelContext } from '@app/component/split-layout/context';import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';import { getIsSpecialProject } from '@block-project/isSpecial';@@ -21,27 +17,24 @@ import {} from '@core/util/upload';import { useQueryClient } from '@queries/client';import { soupKeys } from '@queries/soup/keys';-import { throttledDependent } from '@core/util/debounce';import { refetchResources } from '@service-storage/util/refetchResources';import { toast } from 'core/component/Toast/Toast';import { type Component, createSignal, Show } from 'solid-js';import { TopBar } from './TopBar';-import {- SoupContextProvider,- useSoup,-} from '@app/component/next-soup/soup-context';+import { SoupContextProvider } from '@app/component/next-soup/soup-context';import {createSoupState,type SoupState,} from '@app/component/next-soup/create-soup-state';import { SoupViewContextProvider } from '@app/component/next-soup/soup-view/soup-view-context';import { SoupViewList } from '@app/component/next-soup/soup-view/soup-view';+import { NIL_UUID } from '@app/component/next-soup/filters/filters';// HACK: prevent lint error on custom directivefalse && fileFolderDrop;false && fileSelector;-const PROJECT_ENTITY_TYPES = ['document', 'agent', 'file', 'task'];+const PROJECT_ENTITY_TYPES = ['document', 'task', 'chat', 'project'];const Block: Component = () => {const [isDragging, setIsDragging] = createSignal(false);@@ -92,17 +85,11 @@ const Block: Component = () => {}};- const orchestrator = useGlobalBlockOrchestrator();-- const soup = useSoup();-const previewPanel = useMaybePreviewPanel();const splitPanelContext = useSplitPanelOrThrow();const [preview, setPreview] = splitPanelContext.previewState;- const selectedEntity = () => soup.focus.item();- const throttledSelectedEntity = throttledDependent(selectedEntity, 150);if (!previewPanel) {registerHotkey({@@ -163,13 +150,6 @@ const Block: Component = () => {><ProjectEntityList projectId={projectId} soup={projectSoup} /></SplitPanelContext.Provider>- <Show when={preview()}>- <PreviewPanel- selectedEntity={throttledSelectedEntity()}- orchestrator={orchestrator}- splitPanelContext={splitPanelContext}- />- </Show></div></Show></div>@@ -183,6 +163,9 @@ const ProjectEntityList = (props: { projectId: string; soup: SoupState }) => {<SoupViewContextProvidersoup={props.soup}queryFilters={{+ channel_filters: {+ channel_ids: [NIL_UUID],+ },chat_filters: {project_ids: [props.projectId],},@@ -192,6 +175,9 @@ const ProjectEntityList = (props: { projectId: string; soup: SoupState }) => {document_filters: {project_ids: [props.projectId],},+ email_filters: {+ recipients: [NIL_UUID],+ },}}><SoupViewList customScrollbarHidden={true} />