fix: move fetching data to client side to fix error deployment because blocked by CF#72
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughUpdates CI workflow trigger branch. Adjusts Next.js config (adds publicRuntimeConfig header, removes experimental font loaders). Changes dev server port. Adds i18n strings for 500 error in en/id. Formats ratings to two decimals. Introduces skeleton UIs. Extends room search service (query/header support). Adds 500 page. Rewrites room slug page to client-side fetching. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant NextRouter as Next Router
participant Index as /room/[slug] Page
participant Hook as useSearchRoomQuery
participant Service as roomService.searchRoom
participant API as Rooms API
User->>NextRouter: Navigate to /room/{slug}
NextRouter->>Index: Render with slug
Index->>Index: Show skeleton
Index->>Hook: useSearchRoomQuery(slug)
Hook->>Service: searchRoom({ slug, ... }, headers?)
Service->>API: GET /rooms?bypassCf? + payload<br/>+ optional headers
API-->>Service: 200 with rooms | 404/5xx
Service-->>Hook: Response / Error
Hook-->>Index: data / error / loading=false
alt data.rooms[0] exists
Index->>Index: Select first room
Index->>Index: Set dynamic <head> tags
Index->>Index: Render RoomDetailContainer
else error is 404-like or no room
Index->>Index: Render Page404
else other error
Index->>Index: Render Page500
end
note over Service,API: New: supports bypassCf query and custom headers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (13)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Summary by CodeRabbit
New Features
Refactor
Localization
Chores