refactor: move WebWrapper files from packages/platform to apps/web/modules#9
Conversation
Code Review by Qodo
1. EventRecurringWebWrapper default export
|
| }; | ||
|
|
||
| export default EventRecurringWebWrapper; | ||
| export default EventRecurringWebWrapper; No newline at end of file |
There was a problem hiding this comment.
1. eventrecurringwebwrapper default export 📘 Rule violation ➹ Performance
• apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx uses a default export even though it is not a Next.js page.tsx or layout.tsx file. • This violates the requirement to prefer named exports across the codebase (except where Next.js requires defaults). • Consumers importing this file via next/dynamic should be adjusted to import a named export instead of relying on default.
Agent prompt
## Issue description
`apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx` uses `export default`, but default exports are only allowed in Next.js `page.tsx` / `layout.tsx` (and legacy `apps/web/app/pages/**/*.tsx`) per the compliance checklist.
## Issue Context
`apps/web/modules/event-types/components/EventTypeWebWrapper.tsx` dynamically imports this wrapper using a pattern that currently relies on the module’s default export.
## Fix Focus Areas
- apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]
- apps/web/modules/event-types/components/EventTypeWebWrapper.tsx[73-77]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const BookerWebWrapperComponent = (props: BookerWebWrapperAtomProps) => { | ||
| const router = useRouter(); | ||
| const pathname = usePathname(); | ||
| const searchParams = useSearchParams(); |
There was a problem hiding this comment.
2. Router removed, still used 🐞 Bug ✓ Correctness
• useRouter import and const router = useRouter() were removed from BookerWebWrapper, but router.push(...) is still called in multiple handlers. • This should fail TypeScript compilation (“Cannot find name 'router'”) and breaks booking navigation flows at runtime. • The useCallback dependency array also references router, compounding the compile error.
Agent prompt
### Issue description
`BookerWebWrapper` still uses `router.push(...)` but no longer imports/initializes `router`. This causes a compile-time failure and breaks booking navigation.
### Issue Context
This component is a client component and uses Next.js App Router hooks.
### Fix Focus Areas
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[3-5]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[41-44]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[182-196]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[221-239]
### Suggested fix
1. Add `useRouter` back to the `next/navigation` import.
2. Re-add `const router = useRouter();` near the top of `BookerWebWrapperComponent`.
3. Ensure `onOverlaySwitchStateChange` deps remain correct (`[router]` is fine once defined).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| export function sortHosts( | ||
| hostA: { priority: number | null; weight: number | null }, | ||
| hostB: { priority: number | null; weight: number | null }, | ||
| isRRWeightsEnabled: boolean | ||
| ) { | ||
| const weightA = hostA.weight ?? 100; | ||
| const priorityA = hostA.priority ?? 2; | ||
| const weightB = hostB.weight ?? 100; | ||
| const priorityB = hostB.priority ?? 2; | ||
|
|
||
| if (isRRWeightsEnabled) { | ||
| if (weightA === weightB) { | ||
| return priorityA - priorityB; | ||
| } else { | ||
| return weightB - weightA; | ||
| } | ||
| } else { | ||
| return priorityB - priorityA; | ||
| } |
There was a problem hiding this comment.
3. Host sorting order flipped 🐞 Bug ✓ Correctness
• sortHosts was moved into packages/lib/bookings/hostGroupUtils.ts, but the tie-break logic changed: when RR weights are enabled and weights are equal, it now sorts priority ascending. • Priority values are defined as 0=lowest … 4=highest; elsewhere (non-weighted sorting) priority is sorted descending. • This inconsistency can reorder hosts incorrectly when enabling RR weights, especially since default weights are equal (100), making the tie-break path common.
Agent prompt
### Issue description
`sortHosts` now sorts priorities in ascending order when RR weights are enabled and weights are equal, but priority values indicate higher numbers are higher priority and other branches sort priority descending. This can reorder hosts incorrectly.
### Issue Context
The sort function is used in both web UI and atoms form initialization, and is called with `isRRWeightsEnabled=true`.
### Fix Focus Areas
- packages/lib/bookings/hostGroupUtils.ts[41-59]
### Suggested fix
1. Change the equal-weight branch to return `priorityB - priorityA` (descending) to match the non-weighted branch and priority semantics.
2. (Optional but recommended) Add a small test ensuring:
- when weights are equal and RR weights enabled, higher `priority` sorts first
- when weights differ, higher `weight` sorts first
- when RR weights disabled, higher `priority` sorts first
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| }; | ||
|
|
||
| export default EventLimitsTabWebWrapper; | ||
| export default EventLimitsTabWebWrapper; No newline at end of file |
There was a problem hiding this comment.
4. Missing final newline 🐞 Bug ⛯ Reliability
• Two files are flagged in the PR diff as missing a trailing newline. • Repo .editorconfig requires insert_final_newline = true, so CI formatting/lint checks may fail. • Fix is trivial: add a newline at EOF for both files.
Agent prompt
### Issue description
Two files are missing a final newline, which violates `.editorconfig` and can fail formatting/lint checks.
### Issue Context
Git diff indicates `\ No newline at end of file` for both wrappers.
### Fix Focus Areas
- apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx[1-8]
- apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]
### Suggested fix
Ensure each file ends with a newline after the final `export default ...;` line.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#9