Skip to content

Commit b37ed57

Browse files
committed
Dashboard: Fix broken opengraph-image.tsx (#8094)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the use of `useId` in several components by replacing it with static string values for IDs, improving consistency and potentially performance in the components related to Open Graph images. ### Detailed summary - Removed `useId` from `contract-wallet-analytics.ts`, replacing it with a static variable. - Updated `TWLogo` component in `opengraph-image.tsx` to use static IDs instead of `useId`. - Changed `OgBrandIcon` component in `opengraph-image.tsx` to use a static gradient ID. - Updated `TWLogo` component in another `opengraph-image.tsx` file to use static IDs instead of `useId`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - None. - Bug Fixes - Improved reliability of OpenGraph images by using stable SVG IDs for gradients and clip paths, ensuring consistent rendering across sharing platforms on chain, contract, and drop pages. - Chores - Removed unnecessary debug logging from wallet analytics to reduce console noise. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent c328aa1 commit b37ed57

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/opengraph-image.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ImageResponse } from "next/og";
2-
import { useId } from "react";
32
import { download } from "thirdweb/storage";
43
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs";
54
import { getConfiguredThirdwebClient } from "@/constants/thirdweb.server";
@@ -18,8 +17,8 @@ export const size = {
1817
export const contentType = "image/png";
1918

2019
const TWLogo: React.FC = () => {
21-
const clipPathId = useId();
22-
const linearGradientId = useId();
20+
const clipPathId = "og-tw-logo-clip-path";
21+
const linearGradientId = "og-tw-logo-linear-gradient";
2322
return (
2423
// biome-ignore lint/a11y/noSvgWithoutTitle: not needed
2524
<svg

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/analytics/utils/contract-wallet-analytics.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export async function getContractUniqueWalletAnalytics(params: {
6767
}
6868

6969
const json = (await res.json()) as InsightResponse;
70-
console.log("wallet analytics json", json);
7170
const aggregations = Object.values(json.aggregations[0]);
7271

7372
const returnValue: TransactionAnalyticsEntry[] = [];

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/opengraph-image.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable @next/next/no-img-element */
22
import { ImageResponse } from "@vercel/og";
3-
import { useId } from "react";
43
import { getContractMetadata } from "thirdweb/extensions/common";
54
import { isProd } from "@/constants/env-utils";
65
import { API_ROUTES_CLIENT_ID } from "@/constants/server-envs";
@@ -62,8 +61,9 @@ function shortenString(str: string) {
6261
return `${str.substring(0, 7)}...${str.substring(str.length - 5)}`;
6362
}
6463

64+
const gradientId = "og-brand-icon-gradient";
65+
6566
const OgBrandIcon: React.FC = () => {
66-
const gradientId = useId();
6767
return (
6868
// biome-ignore lint/a11y/noSvgWithoutTitle: not needed
6969
<svg

apps/dashboard/src/app/(app)/drops/[slug]/opengraph-image.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ImageResponse } from "next/og";
2-
import { useId } from "react";
32
import { download } from "thirdweb/storage";
43
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs";
54
import { getConfiguredThirdwebClient } from "@/constants/thirdweb.server";
@@ -19,8 +18,8 @@ export const size = {
1918
export const contentType = "image/png";
2019

2120
const TWLogo: React.FC = () => {
22-
const cipId = useId();
23-
const linearGradientId = useId();
21+
const cipId = "og-tw-logo-clip-path";
22+
const linearGradientId = "og-tw-logo-linear-gradient";
2423

2524
return (
2625
// biome-ignore lint/a11y/noSvgWithoutTitle: not needed

0 commit comments

Comments
 (0)