From 6b85130061bbae94f012fc36bd5ded0d0d1e3d75 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Mon, 30 Mar 2026 19:26:42 +0100 Subject: [PATCH] [#631] Replace direct lookupByAddress with DB-first getFarcasterProfile WriterIdentity.tsx and OG image route were calling lookupByAddress() directly, bypassing the DB cache and hitting paid Neynar API every time. Now uses getFarcasterProfile() which checks DB first. Fixes realproject7/plotlink#631 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app/story/[storylineId]/og/route.tsx | 4 ++-- src/components/WriterIdentity.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/story/[storylineId]/og/route.tsx b/src/app/story/[storylineId]/og/route.tsx index c5fdfe3b..604ad8c4 100644 --- a/src/app/story/[storylineId]/og/route.tsx +++ b/src/app/story/[storylineId]/og/route.tsx @@ -2,7 +2,7 @@ import { ImageResponse } from "next/og"; import { type Address } from "viem"; import { createServerClient, type Storyline } from "../../../../../lib/supabase"; import { getTokenTVL } from "../../../../../lib/price"; -import { lookupByAddress } from "../../../../../lib/farcaster"; +import { getFarcasterProfile } from "../../../../../lib/actions"; import { RESERVE_LABEL, STORY_FACTORY } from "../../../../../lib/contracts/constants"; import { formatPrice } from "../../../../../lib/format"; import { truncateAddress } from "../../../../../lib/utils"; @@ -60,7 +60,7 @@ export async function GET( const [tvlInfo, plotUsd, farcasterProfile, fontData] = await Promise.all([ sl.token_address ? getTokenTVL(sl.token_address as Address) : null, getPlotUsdPrice(), - lookupByAddress(sl.writer_address).catch(() => null), + getFarcasterProfile(sl.writer_address).catch(() => null), loadFont(), ]); diff --git a/src/components/WriterIdentity.tsx b/src/components/WriterIdentity.tsx index d3a805b4..29d9bb3a 100644 --- a/src/components/WriterIdentity.tsx +++ b/src/components/WriterIdentity.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import { lookupByAddress } from "../../lib/farcaster"; +import { getFarcasterProfile } from "../../lib/actions"; import { truncateAddress } from "../../lib/utils"; /** @@ -8,7 +8,7 @@ import { truncateAddress } from "../../lib/utils"; * Links to the internal profile page at /profile/[address]. */ export async function WriterIdentity({ address }: { address: string }) { - const profile = await lookupByAddress(address); + const profile = await getFarcasterProfile(address); if (!profile) { return (