Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update referenced memo title from params
Steven3dbb254aeb92
diff --git a/web/src/components/MemoContent/ReferencedContent/ReferencedMemo.tsx b/web/src/components/MemoContent/ReferencedContent/ReferencedMemo.tsxindex 8fa494cbb..5112ef593 100644--- a/web/src/components/MemoContent/ReferencedContent/ReferencedMemo.tsx+++ b/web/src/components/MemoContent/ReferencedContent/ReferencedMemo.tsx@@ -1,8 +1,7 @@-import { useContext, useEffect } from "react";+import { useEffect } from "react";import useLoading from "@/hooks/useLoading";import useNavigateTo from "@/hooks/useNavigateTo";import { useMemoStore } from "@/store/v1";-import { RendererContext } from "../types";import Error from "./Error";interface Props {@@ -10,13 +9,12 @@ interface Props {params: string;}-const ReferencedMemo = ({ resourceId }: Props) => {- const context = useContext(RendererContext);+const ReferencedMemo = ({ resourceId, params: paramsStr }: Props) => {const navigateTo = useNavigateTo();const loadingState = useLoading();const memoStore = useMemoStore();const memo = memoStore.getMemoByName(resourceId);- const resourceName = `memos/${resourceId}`;+ const params = new URLSearchParams(paramsStr);useEffect(() => {memoStore.getOrFetchMemoByName(resourceId).finally(() => loadingState.setFinish());@@ -28,18 +26,14 @@ const ReferencedMemo = ({ resourceId }: Props) => {if (!memo) {return <Error message={`Memo not found: ${resourceId}`} />;}- if (memo.id === context.memoId || context.embeddedMemos.has(resourceName)) {- return <Error message={`Nested Rendering Error: ![[${resourceName}]]`} />;- }- const displayContent = memo.content.length > 12 ? `${memo.content.slice(0, 12)}...` : memo.content;+ const paramsText = params.has("text") ? params.get("text") : undefined;+ const displayContent = paramsText || (memo.content.length > 12 ? `${memo.content.slice(0, 12)}...` : memo.content);const handleGotoMemoDetailPage = () => {navigateTo(`/m/${memo.name}`);};- // Add the memo to the set of embedded memos. This is used to prevent infinite loops when a memo embeds itself.- context.embeddedMemos.add(resourceName);return (<spanclassName="text-blue-600 whitespace-nowrap dark:text-blue-400 cursor-pointer underline break-all hover:opacity-80 decoration-1"