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(block): remove memos from reactive document name hooks (#1201)

Seamus03f5b56df73c
diff --git a/js/app/packages/core/util/currentBlockDocumentName.ts b/js/app/packages/core/util/currentBlockDocumentName.ts
index 82730526a7..bb8b1d3415 100644
--- a/js/app/packages/core/util/currentBlockDocumentName.ts
+++ b/js/app/packages/core/util/currentBlockDocumentName.ts
@@ -8,7 +8,6 @@ import { blockNameToDefaultFile } from '@core/constant/allBlocks';
import { blockMetadataSignal } from '@core/signal/load';
import { useUpdatedDssItemName } from '@queries/history/history';
import { formatDocumentName } from '@service-storage/util/filename';
-import { createMemo } from 'solid-js';
export const useBlockDocumentName = (defaultName?: string) => {
if (!isInBlock()) {
@@ -19,7 +18,7 @@ export const useBlockDocumentName = (defaultName?: string) => {
const updatedName = useUpdatedDssItemName(useBlockId());
- return createMemo(() => {
+ return () => {
const current = updatedName();
if (current) return current;
if (defaultName !== undefined) return defaultName;
@@ -27,17 +26,16 @@ export const useBlockDocumentName = (defaultName?: string) => {
return blockNameToDefaultFile(blockName);
}
return '';
- });
+ };
};
export const useBlockDocumentDownloadName = (defaultName?: string) => {
const documentName = useBlockDocumentName(defaultName);
- return createMemo(() => {
+ return () => {
let current = documentName();
if (!current) current = 'download';
-
const fileType = blockMetadataSignal()?.fileType;
return formatDocumentName(current, fileType);
- });
+ };
};
diff --git a/js/app/packages/queries/history/history.ts b/js/app/packages/queries/history/history.ts
index 79d3268fcb..dc0ad3512c 100644
--- a/js/app/packages/queries/history/history.ts
+++ b/js/app/packages/queries/history/history.ts
@@ -8,7 +8,7 @@ import {
useMutation,
useQuery,
} from '@tanstack/solid-query';
-import { type Accessor, createMemo } from 'solid-js';
+import type { Accessor } from 'solid-js';
import { queryClient } from '../client';
import { historyKeys } from './keys';
import {
@@ -322,7 +322,8 @@ export async function removeHistoryItem(
export function useUpdatedDssItemName(itemId: string | Accessor<string>) {
const historyQuery = useHistoryQuery();
- return createMemo(() => {
+ return () => {
+ if (historyQuery.isLoading) return undefined;
const history = historyQuery.data;
if (!history) return undefined;
@@ -331,7 +332,7 @@ export function useUpdatedDssItemName(itemId: string | Accessor<string>) {
const item = history.find((item) => item.id === itemIdValue);
return item?.name;
- });
+ };
}
/**