Skip to content

fix: resolve Select component hydration issue in booking dialog #2237

Merged
DonKoko merged 2 commits intomainfrom
fix-hydration-issue-on-asset-index
Dec 11, 2025
Merged

fix: resolve Select component hydration issue in booking dialog #2237
DonKoko merged 2 commits intomainfrom
fix-hydration-issue-on-asset-index

Conversation

@DonKoko
Copy link
Copy Markdown
Contributor

@DonKoko DonKoko commented Dec 11, 2025

Fix React Error hydration mismatch in AddAssetsToExistingBookingDialog
that prevented the select dropdown from opening in production.

Changes:

  • Remove asChild prop from SelectItem to prevent hydration issues
  • Add position="popper" to SelectContent for better modal positioning
  • Use --radix-select-trigger-width CSS variable to match trigger width
  • Pin Node version in Dockerfile to 22.20.0 to match local environment

The asChild prop combined with the DateS component (which uses timezone
hints) caused server/client HTML mismatch. This aligns with patterns used
in other working dialogs like invite-user-dialog.tsx.

Fix React Error #418 hydration mismatch in AddAssetsToExistingBookingDialog
that prevented the select dropdown from opening in production.

Changes:
- Remove `asChild` prop from SelectItem to prevent hydration issues
- Add `position="popper"` to SelectContent for better modal positioning
- Use `--radix-select-trigger-width` CSS variable to match trigger width
- Pin Node version in Dockerfile to 22.20.0 to match local environment

The `asChild` prop combined with the DateS component (which uses timezone
hints) caused server/client HTML mismatch. This aligns with patterns used
in other working dialogs like invite-user-dialog.tsx.
Refactor AddAssetsToExistingBookingDialog to use useApiQuery hook instead
of manual fetch calls, and add comprehensive empty state handling.

Changes to dialog component:
- Replace manual fetch with useApiQuery hook for better error handling
- Add dynamic placeholder text based on loading/empty/ready states
- Show empty state message in dropdown when no bookings available
- Add informative message when no draft/reserved bookings exist
- Update type definitions to match API response structure

Changes to API endpoint:
- Update bookings.get-all to return both DRAFT and RESERVED bookings
- Previously only returned DRAFT, now includes RESERVED for better UX
- Aligns with pattern used elsewhere in codebase for booking selection

This fixes inconsistent behavior where bookings would sometimes not load,
and provides clear feedback to users when no bookings are available.
@vercel
Copy link
Copy Markdown

vercel bot commented Dec 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
shelf-docs Ignored Ignored Dec 11, 2025 1:12pm

@DonKoko DonKoko merged commit 246abce into main Dec 11, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant