kobaltedev / kobalte

A UI toolkit for building accessible web apps and design systems with SolidJS.
https://kobalte.dev
MIT License
1.22k stars 62 forks source link

Accordion Solid Start SSR #385

Closed 0-don closed 1 week ago

0-don commented 5 months ago

Describe the bug There is a hydration issue with the Kobalte Accordion when using the defaultValue prop in a SolidStart application. The Accordion only functions correctly when Server-Side Rendering (SSR) is disabled.

<Accordion multiple defaultValue={["FAQ_WHAT_CAN_I_DO_HERE"]} class="w-full">
  <For each={faqs}>
    {({ question, answer }) => (
      <AccordionItem value={question}>
        <AccordionTrigger>{t()?.[question]}</AccordionTrigger>
        <AccordionContent innerHTML={t()?.[answer]} />
      </AccordionItem>
    )}
  </For>
</Accordion>

To Reproduce Steps to reproduce the behavior:

  1. Go to the page where the Accordion is implemented.
  2. Observe that the default value specified does not hydrate correctly when the page loads.
  3. Notice that disabling SSR temporarily resolves the issue.

Expected behavior The Accordion should properly hydrate with the default value specified (defaultValue={["FAQ_WHAT_CAN_I_DO_HERE"]}) when the page loads, without needing to disable SSR.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context This issue may be related to the initialization of state or props during the SSR phase. Further investigation into how SolidStart handles hydration in conjunction with the Kobalte Accordion's defaultValue might be required. The latest version of all related software is being used.

jer3m01 commented 1 week ago

fixed by https://github.com/kobaltedev/kobalte/pull/483