From 2e1bfecb5ffb9a37a1732f703d7d8fddfa357bc0 Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Mon, 1 Jun 2026 16:25:49 -0700 Subject: [PATCH] Fix types --- .../products/page-client-list-view.tsx | 12 +- .../data-table/common/stable-value.tsx | 4 +- .../stack-companion/changelog-widget.tsx | 6 +- .../src/components/ui/copy-button.tsx | 10 +- .../src/components/ui/dropdown-menu.tsx | 4 +- docs/package.json | 8 +- .../src/components/chat/message-formatter.tsx | 28 +- .../layout/custom-search-dialog.tsx | 2 +- docs/src/components/mdx/base-codeblock.tsx | 2 +- docs/src/components/mdx/jwt-viewer.tsx | 4 +- examples/demo/src/app/layout.tsx | 5 +- examples/middleware/src/app/layout.tsx | 4 +- packages/react/package.json | 4 +- packages/stack-shared/src/hooks/use-hover.tsx | 2 +- packages/stack-shared/src/utils/react.tsx | 2 +- .../stack-ui/src/components/action-dialog.tsx | 6 +- .../stack-ui/src/components/copy-button.tsx | 6 +- .../src/components/ui/dropdown-menu.tsx | 4 +- packages/stack/package.json | 8 +- packages/tanstack-start/package.json | 4 +- packages/template/package-template.json | 8 +- packages/template/package.json | 8 +- .../template/src/components/oauth-button.tsx | 3 +- pnpm-lock.yaml | 727 ++++-------------- 24 files changed, 215 insertions(+), 656 deletions(-) diff --git a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-list-view.tsx b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-list-view.tsx index 805756bce..2c2100694 100644 --- a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-list-view.tsx +++ b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-list-view.tsx @@ -79,7 +79,7 @@ type ListItemProps = { onMouseLeave?: () => void, isEven?: boolean, isHighlighted?: boolean, - itemRef?: React.RefObject, + itemRef?: React.RefObject, actionItems?: ActionMenuItem[], }; @@ -180,9 +180,9 @@ function ListGroup({ title, children }: ListGroupProps) { // Connection line component type ConnectionLineProps = { - fromRef: React.RefObject, - toRef: React.RefObject, - containerRef: React.RefObject, + fromRef: React.RefObject, + toRef: React.RefObject, + containerRef: React.RefObject, quantity?: number, }; @@ -320,7 +320,7 @@ type ProductsListProps = { paymentsGroups: any, hoveredItemId: string | null, getConnectedProducts: (itemId: string) => string[], - productRefs?: Record>, + productRefs?: Record>, onProductMouseEnter: (productId: string) => void, onProductMouseLeave: () => void, onProductAdd?: () => void, @@ -470,7 +470,7 @@ type ItemsListProps = { items: CompleteConfig['payments']['items'], hoveredProductId: string | null, getConnectedItems: (productId: string) => string[], - itemRefs?: Record>, + itemRefs?: Record>, onItemMouseEnter: (itemId: string) => void, onItemMouseLeave: () => void, onItemAdd?: () => void, diff --git a/apps/dashboard/src/components/data-table/common/stable-value.tsx b/apps/dashboard/src/components/data-table/common/stable-value.tsx index ef949c5aa..b552367e4 100644 --- a/apps/dashboard/src/components/data-table/common/stable-value.tsx +++ b/apps/dashboard/src/components/data-table/common/stable-value.tsx @@ -3,8 +3,8 @@ import { useRef } from "react"; export function useStableValue(value: T, fingerprint: string): T { - const previousRef = useRef<{ fingerprint: string, value: T }>(); - if (previousRef.current && previousRef.current.fingerprint === fingerprint) { + const previousRef = useRef<{ fingerprint: string, value: T } | null>(null); + if (previousRef.current != null && previousRef.current.fingerprint === fingerprint) { return previousRef.current.value; } previousRef.current = { fingerprint, value }; diff --git a/apps/dashboard/src/components/stack-companion/changelog-widget.tsx b/apps/dashboard/src/components/stack-companion/changelog-widget.tsx index 0b5dff3d5..865ada9ac 100644 --- a/apps/dashboard/src/components/stack-companion/changelog-widget.tsx +++ b/apps/dashboard/src/components/stack-companion/changelog-widget.tsx @@ -6,7 +6,7 @@ import { CalendarIcon, CaretDownIcon, CaretUpIcon, InfoIcon, XIcon } from '@phos import { captureError } from '@hexclave/shared/dist/utils/errors'; import { runAsynchronously } from '@hexclave/shared/dist/utils/promises'; import Image from 'next/image'; -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState, type ComponentPropsWithoutRef } from 'react'; import { createPortal } from 'react-dom'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; @@ -101,8 +101,8 @@ export function ChangelogWidget({ isActive, initialData }: ChangelogWidgetProps) ), - img: ({ src, alt }: { src?: string, alt?: string }) => { - if (!src) return null; + img: ({ src, alt }: ComponentPropsWithoutRef<'img'>) => { + if (typeof src !== 'string') return null; return (