Skip to content

Commit 16145dc

Browse files
committed
fix(docs): fill the Ask Sim UI gap while the panel chunk loads
handleOpen set open=true synchronously, hiding the trigger button before the dynamically imported panel had a chance to render anything (next/dynamic renders null by default with no loading option) - on a slow connection neither the button nor the panel was visible. Added a loading fallback in the same fixed position so there's no gap between the button disappearing and the real panel appearing.
1 parent 711b3a4 commit 16145dc

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/docs/components/ai/ask-ai.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import dynamic from 'next/dynamic'
66

77
const AskAIPanel = dynamic(() => import('./ask-ai-panel').then((m) => m.AskAIPanel), {
88
ssr: false,
9+
loading: () => (
10+
<div
11+
aria-hidden
12+
className='fixed right-4 bottom-4 z-50 flex size-11 items-center justify-center rounded-full border border-[var(--border-1)] bg-[var(--surface-5)] shadow-[var(--shadow-medium)] dark:bg-[var(--surface-4)]'
13+
>
14+
<MessageCircle className='size-[16px] animate-pulse text-[var(--text-icon)]' />
15+
</div>
16+
),
917
})
1018

1119
interface AskAIProps {

0 commit comments

Comments
 (0)