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(web): preserve document file types in quick access (#6993)

dev-rb6f63a4c559de
diff --git a/apps/web/src/lib/queries/history/graphql.ts b/apps/web/src/lib/queries/history/graphql.ts
index e29472db3b..0cd0dc2979 100644
--- a/apps/web/src/lib/queries/history/graphql.ts
+++ b/apps/web/src/lib/queries/history/graphql.ts
@@ -85,7 +85,7 @@ function historyItemFromSearchDocument(
return {
...base,
type: 'document',
- fileType: markdown ? 'md' : undefined,
+ fileType: record.fileType ?? (markdown ? 'md' : undefined),
subType,
} as HistoryItem;
}
diff --git a/apps/web/src/lib/queries/history/tests/graphql.test.ts b/apps/web/src/lib/queries/history/tests/graphql.test.ts
index 142c771a07..6d8897eb0c 100644
--- a/apps/web/src/lib/queries/history/tests/graphql.test.ts
+++ b/apps/web/src/lib/queries/history/tests/graphql.test.ts
@@ -128,6 +128,45 @@ describe('cached GraphQL history', () => {
}
});
+ it('preserves PDF file types for quick-access navigation and icons', async () => {
+ const documentKey = 'GraphqlSoupDocument:document-pdf';
+ const host = cacheHost(
+ async () => ({
+ documents: [
+ {
+ profile: 'quick-access-v1',
+ recordKey: documentKey,
+ bucket: 'document',
+ searchText: 'example pdf',
+ timestampMs: Date.parse('2025-01-05T00:00:00.000Z'),
+ sourceHash: 'pdf',
+ },
+ ],
+ nextCursor: null,
+ }),
+ async ({ document }) => {
+ expect(document).toMatch(/fileType/);
+ return [
+ {
+ recordKey: documentKey,
+ record: {
+ __typename: 'GraphqlSoupDocument',
+ name: 'Example PDF',
+ fileType: 'pdf',
+ ownerId: 'document-owner',
+ createdAt: '2025-01-01T00:00:00.000Z',
+ subType: null,
+ },
+ },
+ ];
+ }
+ );
+
+ await expect(readCachedGraphqlHistoryItems(host)).resolves.toMatchObject([
+ { id: 'document-pdf', type: 'document', fileType: 'pdf' },
+ ]);
+ });
+
it('omits keys whose minimal name projection is incomplete', async () => {
const search = vi.fn(
async (): Promise<SearchCachePage> => ({
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
index 18b30bdaf0..eb8858573f 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
@@ -6885,7 +6885,7 @@ export type GraphqlChatHistoryFieldsFragment = { __typename: 'GraphqlSoupChat',
export type GraphqlProjectHistoryFieldsFragment = { __typename: 'GraphqlSoupProject', id: string, ownerId: string, createdAt: string, updatedAt: string, viewedAt: string | null, deletedAt: string | null, projectName: string };
-export type GraphqlDocumentQuickAccessNameFragment = { __typename: 'GraphqlSoupDocument', name: string, ownerId: string, createdAt: string, subType:
+export type GraphqlDocumentQuickAccessNameFragment = { __typename: 'GraphqlSoupDocument', name: string, fileType: string | null, ownerId: string, createdAt: string, subType:
| { __typename: 'GraphqlInitiativeDescriptionSubType' }
| { __typename: 'GraphqlSkillSubType' }
| { __typename: 'GraphqlSnippetSubType' }
@@ -11963,7 +11963,7 @@ export const FavoriteFieldsFragmentDoc = {"kind":"Document","definitions":[{"kin
export const GraphqlDocumentHistoryFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlDocumentHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}}]}}]} as unknown as DocumentNode<GraphqlDocumentHistoryFieldsFragment, unknown>;
export const GraphqlChatHistoryFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlChatHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<GraphqlChatHistoryFieldsFragment, unknown>;
export const GraphqlProjectHistoryFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlProjectHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode<GraphqlProjectHistoryFieldsFragment, unknown>;
-export const GraphqlDocumentQuickAccessNameFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlDocumentQuickAccessName"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}}]}}]} as unknown as DocumentNode<GraphqlDocumentQuickAccessNameFragment, unknown>;
+export const GraphqlDocumentQuickAccessNameFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlDocumentQuickAccessName"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}}]}}]} as unknown as DocumentNode<GraphqlDocumentQuickAccessNameFragment, unknown>;
export const GraphqlChatQuickAccessNameFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlChatQuickAccessName"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]} as unknown as DocumentNode<GraphqlChatQuickAccessNameFragment, unknown>;
export const GraphqlProjectQuickAccessNameFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlProjectQuickAccessName"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]} as unknown as DocumentNode<GraphqlProjectQuickAccessNameFragment, unknown>;
export const GraphqlChannelQuickAccessFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlChannelQuickAccessFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}}]}}]}}]} as unknown as DocumentNode<GraphqlChannelQuickAccessFieldsFragment, unknown>;
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/history.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/history.graphql
index 64c4bab149..fa6158d353 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/history.graphql
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/history.graphql
@@ -42,6 +42,7 @@ fragment GraphqlProjectHistoryFields on GraphqlSoupProject {
fragment GraphqlDocumentQuickAccessName on GraphqlSoupDocument {
__typename
name
+ fileType
ownerId
createdAt
subType {