Skip to content

perf: reuse primed creator metadata#9

Merged
markbang merged 1 commit into
mainfrom
perf/creator-cache-priming
Mar 31, 2026
Merged

perf: reuse primed creator metadata#9
markbang merged 1 commit into
mainfrom
perf/creator-cache-priming

Conversation

@markbang
Copy link
Copy Markdown
Owner

@markbang markbang commented Mar 31, 2026

Summary

  • retain a stable creatorId on normalized memos
  • prime user cache entries by creator id and username so later memo fetches can skip duplicate /users/:id lookups
  • add regression coverage for cross-memo creator cache reuse

Testing

  • pnpm validate

Summary by cubic

Reuse primed creator metadata across memo fetches in memos-embed to cut duplicate /users/:id requests and speed up createMemoClient. Adds a stable creatorId during memo normalization so the user cache can be keyed by both id and username.

  • New Features
    • Memo now exposes creatorId.
    • createMemoClient primes and reuses creator details keyed by id, username, and users/:id name so later fetchMemo calls skip user lookups.

Written for commit 1716bb7. Summary will update on new commits.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
memos-embed-site Ready Ready Preview, Comment Mar 31, 2026 7:09am

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/memos-embed/src/api.ts">

<violation number="1" location="packages/memos-embed/src/api.ts:334">
P2: Cached user `id` can be incorrectly set to username when `creatorId` is missing, producing inconsistent user objects for id-keyed cache hits.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

}

const cachedUser = Promise.resolve({
id: memo.creatorId ?? creatorCacheKeys[0] ?? "",
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Cached user id can be incorrectly set to username when creatorId is missing, producing inconsistent user objects for id-keyed cache hits.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/memos-embed/src/api.ts, line 334:

<comment>Cached user `id` can be incorrectly set to username when `creatorId` is missing, producing inconsistent user objects for id-keyed cache hits.</comment>

<file context>
@@ -307,20 +321,30 @@ const primeMemoInCache = ({
+	}
+
+	const cachedUser = Promise.resolve({
+		id: memo.creatorId ?? creatorCacheKeys[0] ?? "",
+		name: memo.creatorId
+			? `users/${memo.creatorId}`
</file context>
Fix with Cubic

@markbang markbang merged commit 2a4cbe0 into main Mar 31, 2026
4 checks passed
@markbang markbang deleted the perf/creator-cache-priming branch March 31, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant