Strip template artifacts and fix lint errors
Remove npm lockfile, unused create-next-app SVGs, project-specific next.config workarounds, and the unused @remixicon/react and date-fns deps. Replace three set-state-in-effect patterns with useSyncExternalStore in use-mobile, DialogPortal, and Carousel; the carousel change also fixes a leaked reInit listener. yarn lint and yarn build are clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K8PmydbW6A1S2Tw3SFc3Cg
This commit is contained in:
@@ -19,15 +19,21 @@ function DialogTrigger({
|
||||
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
||||
}
|
||||
|
||||
const subscribeToNothing = () => () => {}
|
||||
|
||||
function DialogPortal({
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
||||
// Radix's Portal calls createPortal(children, document.body) as soon as it
|
||||
// renders. During static prerendering there's no `document`, so gate the
|
||||
// portal behind an effect that only runs in the browser. Closed dialogs
|
||||
// render nothing on the server anyway, so there's no visual/hydration change.
|
||||
const [mounted, setMounted] = React.useState(false)
|
||||
React.useEffect(() => setMounted(true), [])
|
||||
// portal on the client snapshot, which is only read in the browser. Closed
|
||||
// dialogs render nothing on the server anyway, so there's no visual/
|
||||
// hydration change.
|
||||
const mounted = React.useSyncExternalStore(
|
||||
subscribeToNothing,
|
||||
() => true,
|
||||
() => false
|
||||
)
|
||||
|
||||
if (!mounted) return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user