MCPcopy Create free account
hub / github.com/block/buzz / useStableArray

Function useStableArray

desktop/src/shared/ui/markdown/utils.ts:6–15  ·  view source on GitHub ↗
(arr: T[])

Source from the content-addressed store, hash-verified

4import { isMessageLink } from "@/features/messages/lib/messageLink";
5
6export function useStableArray<T>(arr: T[]): T[] {
7 const ref = React.useRef(arr);
8 if (
9 arr.length !== ref.current.length ||
10 arr.some((item, i) => item !== ref.current[i])
11 ) {
12 ref.current = arr;
13 }
14 return ref.current;
15}
16
17export function aspectRatioFromDim(dim?: string): number | undefined {
18 if (!dim) return undefined;

Callers 1

MarkdownInnerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected