From 806b64c9ae65fcf338620bff07edeb3f98d926a6 Mon Sep 17 00:00:00 2001 From: Rosco Kalis Date: Mon, 9 Dec 2024 15:43:09 +0100 Subject: [PATCH] Small fixes --- components/common/donate/TipSection.tsx | 2 +- lib/i18n/csr-navigation.tsx | 16 ++++++++++------ lib/utils/og.tsx | 6 ++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/common/donate/TipSection.tsx b/components/common/donate/TipSection.tsx index 7a1032c83..68fd3ccb1 100644 --- a/components/common/donate/TipSection.tsx +++ b/components/common/donate/TipSection.tsx @@ -84,7 +84,7 @@ const TipOption = ({ amount, children, nativeToken }: TipOptionProps) => { {children ?? `${amount} ${nativeToken}`} diff --git a/lib/i18n/csr-navigation.tsx b/lib/i18n/csr-navigation.tsx index cda8bc5e3..bd7a4910a 100644 --- a/lib/i18n/csr-navigation.tsx +++ b/lib/i18n/csr-navigation.tsx @@ -3,7 +3,7 @@ import { Nullable } from 'lib/interfaces'; import { ReadonlyURLSearchParams, useSearchParams } from 'next/navigation'; import nProgress from 'nprogress'; -import { ComponentProps } from 'react'; +import { ComponentProps, ForwardedRef, forwardRef } from 'react'; import { UrlObject } from 'url'; import { Link, useRouter } from './navigation'; @@ -27,11 +27,15 @@ const getHrefRetainingCurrentSearchParams = ( return `${path}?${mergedSearchParams.toString()}`; }; -export function CsrLink(props: ComponentProps & { retainSearchParams?: boolean | string[] }) { - const searchParams = useSearchParams(); - const resolvedHref = getHrefRetainingCurrentSearchParams(props.href, searchParams, props.retainSearchParams); - return ; -} +type CsrLinkProps = ComponentProps & { retainSearchParams?: boolean | string[] }; + +export const CsrLink = forwardRef( + ({ retainSearchParams, ...props }: CsrLinkProps, ref: ForwardedRef) => { + const searchParams = useSearchParams(); + const resolvedHref = getHrefRetainingCurrentSearchParams(props.href, searchParams, retainSearchParams); + return ; + }, +); export function useCsrRouter() { const router = useRouter(); diff --git a/lib/utils/og.tsx b/lib/utils/og.tsx index c82095df9..33c41c2a8 100644 --- a/lib/utils/og.tsx +++ b/lib/utils/og.tsx @@ -24,13 +24,11 @@ export const generateOgImage = ({ title, background }: OgImageProps) => { const width = 1200; const height = 630; - const SKIP_OG_IMAGES = process.env.SKIP_OG_IMAGES === 'true'; - const base64Image = loadFile('public/assets/images/opengraph-image.jpg'); - // If SKIP_OG_IMAGES is true, return a placeholder image instead of generating one dynamically. // This significantly speeds up builds during emergency patches by skipping resource-intensive OG image generation. + const SKIP_OG_IMAGES = process.env.SKIP_OG_IMAGES === 'true'; if (SKIP_OG_IMAGES) { - return new Response(base64Image, { + return new Response(loadFile('public/assets/images/opengraph-image.jpg'), { headers: { 'Content-Type': 'image/jpeg', 'Cache-Control': 'public, max-age=31536000, immutable',