feat : overhual [no ci]
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { cloneElement, type ReactElement } from "react";
|
||||
import { Children, cloneElement, type ReactElement } from "react";
|
||||
import { useTranslation } from "./locale-provider";
|
||||
import { exportStatLabel, type ExportMessageKey } from "@/lib/guides/export-text";
|
||||
import type { MessageParams } from "@/lib/i18n/messages";
|
||||
@@ -28,7 +28,9 @@ export function Localized({ children, attributes }: {
|
||||
const props = Object.fromEntries(Object.entries(attributes).map(([key, value]) => [
|
||||
key, typeof value === "string" ? t(value) : t(value.message, value.params),
|
||||
]));
|
||||
return cloneElement(children, props);
|
||||
// Children.toArray resolves lazy children streamed across the server/client boundary.
|
||||
const child = Children.only(Children.toArray(children)[0]) as ReactElement;
|
||||
return cloneElement(child, props);
|
||||
}
|
||||
|
||||
export function MetricText({ value }: { value: string }) {
|
||||
|
||||
Reference in New Issue
Block a user