From 304893dfdeebaea15ed20084915660e01ab19274 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 9 Sep 2026 17:50:52 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B4=80=EA=B3=84=20=ED=95=98=EB=82=98?= =?UTF-8?q?=EA=B0=80=20=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=EB=A5=BC=20=EB=B2=84=EB=A6=AC=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EA=B2=8C=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 편집기 오른쪽이 통째로 「초안을 미리 볼 수 없습니다」가 되고 이유로 UUID 하나만 보여 줬다. 본문을 쓰는 동안 본문을 볼 수 없었다. 원인은 관계 후보 목록의 개수 상한이다. 계약이 limit 을 100 으로 못박고 있고, 기록이 그 수를 넘자 목록 밖의 기록을 가리킨 문서는 전부 이 상태가 됐다. 관계가 실제로 끊겼는지는 검증이 판정한다(RELATION_TARGET_NOT_FOUND). 서버가 자기 저장소를 직접 보므로 목록 상한과 무관하다. 미리보기가 할 일은 지금 쓰고 있는 글을 보여 주는 것이고, 이름을 모르는 관계 한 줄은 그렇다고 적으면 된다. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01PTnWufiY9ATv57egkKKVAV --- .../project-public-render-model.ts | 35 ++++++++++++++----- .../components/document-editor-screen.tsx | 5 +++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/features/tech-log/domain/content-format/project-public-render-model.ts b/src/features/tech-log/domain/content-format/project-public-render-model.ts index 5d26280..9ebb1f4 100644 --- a/src/features/tech-log/domain/content-format/project-public-render-model.ts +++ b/src/features/tech-log/domain/content-format/project-public-render-model.ts @@ -99,6 +99,8 @@ function catalogEntry( id: string | null, type: CatalogEntry["type"], required: boolean, + /** 목록에 없을 때 미리보기를 통째로 버릴 것인가. 관계만 예외다 — 목록에 상한이 있기 때문이다. */ + failWhenMissing = true, ): CatalogEntry | null { if (!id) { if (required) fail(`${type} catalog entry is required`); @@ -107,9 +109,10 @@ function catalogEntry( const entry = catalog.find((candidate) => candidate.id === id); if (!entry || entry.type !== type) { + if (!failWhenMissing) return null; fail(`${type} catalog entry not found: ${id}`); } - return entry; + return entry ?? null; } function displayTarget( @@ -182,13 +185,29 @@ function resolvedRelations( .sort((left, right) => left.order - right.order) .map((relation, index) => { if (!relation.targetId) fail("RELATION catalog entry is required"); - const target = catalogEntry( - catalog, - relation.targetId, - "RELATION", - true, - ); - if (!target?.kind) fail(`RELATION kind is required: ${relation.targetId}`); + /* + 고른 대상이 카탈로그에 없다고 미리보기 전체를 버리지 않는다. + + 관계 후보 목록은 개수 상한이 있다. 기록이 그 상한을 넘어서자, 상한 밖의 기록을 가리킨 + 문서는 편집기 오른쪽이 통째로 「초안을 미리 볼 수 없습니다」가 됐다 — 본문을 쓰는 동안 + 본문을 볼 수 없었고, 화면은 그 이유로 UUID 하나만 보여 줬다. + + 관계가 실제로 끊겼는지는 검증이 판정한다(`RELATION_TARGET_NOT_FOUND`). 서버가 자기 + 저장소를 직접 보므로 목록 상한과 무관하다. 미리보기가 할 일은 지금 쓰고 있는 글을 + 보여 주는 것이고, 이름을 모르는 관계 한 줄은 그렇다고 적으면 된다. + */ + const target = catalogEntry(catalog, relation.targetId, "RELATION", false, false); + if (!target?.kind) { + return { + id: relation.id ?? `relation-${index + 1}`, + targetId: relation.targetId, + targetKind: "CASE" as const, + title: "목록에 없는 기록", + publicPath: null, + reason: relation.reason, + order: relation.order, + }; + } return { id: relation.id ?? `relation-${index + 1}`, targetId: target.id, diff --git a/src/features/tech-log/presentation/studio/components/document-editor-screen.tsx b/src/features/tech-log/presentation/studio/components/document-editor-screen.tsx index 7a8ffad..b98733f 100644 --- a/src/features/tech-log/presentation/studio/components/document-editor-screen.tsx +++ b/src/features/tech-log/presentation/studio/components/document-editor-screen.tsx @@ -99,6 +99,11 @@ export function DocumentEditorScreen({ documentId }: { documentId: string }) { setAssets([]); void Promise.all([ studio.gateway.getDocument(documentId, { signal: request.signal }), + /* + 100 은 계약이 정한 상한이다(`Limit.maximum`). 기록이 그 수를 넘으면 목록 뒤쪽은 여기 + 오지 않으므로, 미리보기가 이 목록에 기대지 않게 따로 고쳤다 — 목록에 없는 관계는 + 그렇게 적고 나머지를 그린다. 고르는 쪽은 관계 편집기의 검색이 맡는다. + */ ...catalogTypes.map((type) => studio.gateway.getCatalog( { type, limit: 100 }, { signal: request.signal },