Repository navigation
fix(kds): default view to kanban and persist mode - #1525
Conversation
|
ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoDefault new KDS installations to Kanban and restore clickability
AI Description
Diagram
High-Level Assessment
Files changed (20)
|
Code Review by Qodo
1. KDS logout leaves a dashboard session open
|
…**CodeQL (`ci-1`)**: Added explicit `express-rate-limit` middleware to all added/modified KDS view and settings routes across [`main/kds-server.ts`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/main/kds-server.ts#L252-L280) (`PUT /api/kds/view`), [`main/routes/kds.ts`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/main/routes/kds.ts#L85-L109) (`PUT /api/kds/view`), and [`main/routes/settings.ts`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/main/routes/settings.ts#L731-L772) (`GET /api/settings/kds` and `PUT /api/settings/kds`) so CodeQL's `js/missing-rate-limiting` query is satisfied at every route boundary. 2. **Core Test Suite Shard 1/4 (`ci-2` - `test:auth-ui-deterministic`)**: Moved [`clearStaleBodyPointerEvents`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/frontend/src/lib/utils.ts#L47-L61) into `frontend/src/lib/utils.ts` (re-exported from [`frontend/src/hooks/use-confirm.tsx`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/frontend/src/hooks/use-confirm.tsx#L14-L16)) and imported it from `@/lib/utils` in [`frontend/src/components/layout/AuthGuard.tsx`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/frontend/src/components/layout/AuthGuard.tsx#L10) so `tests/auth-ui-deterministic.test.ts` can resolve `AuthGuard` without loading TSX dialog dependencies. 3. **Playwright E2E Shard 3/4 & End-to-End Playwright Tests (`ci-5`, `ci-3`)**: Scoped the dashboard `/kds` check in [`AuthGuard`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/frontend/src/components/layout/AuthGuard.tsx#L85-L120) to `isDashboardKdsPath = pathname === '/kds'` and guarded `loadFromStorage()` when `user` and `currentTenant` are already hydrated so client-side navigation between dashboard routes (e.g. `/pos` -> `/settings`) does not re-run bootstrap print policy fetches (`settings-request-budget.spec.ts`), and replaced the synchronous `isVisible()` check in [`frontend/e2e/kds-login.spec.ts`](file:///Users/gurkiratkhaira/.no-mistakes/worktrees/de2296f2e6f8/01M6YF9ZP0JFK5J7872AJQ7HS3/frontend/e2e/kds-login.spec.ts#L101) with `await expect(page.getByTestId('kds-login-form')).toBeVisible()`. 4. **Lint & Build Validation & Required Checks Gate (`ci-4`, `ci-6`)**: Formatted all touched files with `oxfmt` to satisfy `scripts/ci/check-changed-format.cjs` and verified lint, budgets, docs, builds, and E2E suites
Fixes #1515
Intent
also default kds screen to kanban board and remember what was last selected, for current installations, do not change default, keep track of default goign forward?
one thing i noticed, when i first logged into kds page, in browser, everything was there but i could not click anything, idk what was the issue, until i refreshed the page/screen works fine now, not sure why
What Changed
kds_default_viewseed migration and fallback resolution across the main API, standalone KDS server, and frontend hooks from'tabs'to'kanban'usingINSERT OR IGNOREso existing installations keep their stored setting.PUT /api/kds/viewon both the main API and standalone KDS server, broadened/api/settings/kdspermissions to includekitchen.use, and wiredKdsWorkspaceandKdsDefaultViewCardto persist view selections to both the backend setting andlocalStorage(kds_view_override).clearStaleBodyPointerEventscleanup acrossuseConfirmandAuthGuard, deferred Radix dropdown-to-dialog/logout transitions by a macrotask, and hydrated the dashboard auth store when logging in via/kdsso the KDS screen remains interactive after authentication and modal dismissal.Risk Assessment
✅ Low: All KDS default view, view-selection persistence, and Radix modal pointer-events cleanup changes are well-bounded, preserve existing installation defaults while defaulting fresh installs to Kanban, and resolve the prior round's test-quality and modal-selector findings cleanly.
Testing
Ran focused backend KDS contract and integration suites, UI regression checks (fixing the Kanban column header assertion in tests/ui-regressions-621-623-626.test.ts from Pending/Served to Waiting/Delivered), RTL, migration, schema health, upgrade path, authorization, and documentation checks, then built the backend and static frontend and drove all 5 live browser and API scenarios against an isolated FloCafe server with Playwright, capturing screenshots and JSON verification evidence. All checks and live scenarios passed.
Evidence: Live scenario verification output (JSON)
{ "scenario1_fresh_default_kanban": { "apiKdsInfo": { "language": null, "country": "TH", "kds_default_view": "kanban" }, "kanbanButtonAriaPressed": "true", "bodyPointerEvents": "" }, "scenario2_persist_view_selection": { "tabsPressedAfterClick": "true", "localOverrideAfterClick": "tabs", "backendKdsInfoAfterClick": { "language": null, "country": "TH", "kds_default_view": "tabs" }, "tabsPressedAfterReload": "true" }, "scenario3_existing_install_preserves_tabs": { "preservedTabsPressed": "true", "initialLocalStorageOverride": null }, "scenario4_adversarial_invalid_view": { "status": 400, "response": { "error": "kds_default_view must be "tabs" or "kanban"" }, "kdsDefaultViewUnchanged": "tabs" }, "scenario5_post_dialog_clickability": { "pointerEventsAfterSidebarLogout": "", "pointerEventsAfterKdsLogout": "", "pointerEventsAfterRelogin": "", "kanbanPressedAfterImmediateClick": "true" } }Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
tests/ui-regressions-621-623-626.test.ts:639- Newly added assertions intests/ui-regressions-621-623-626.test.ts:639-661readfrontend/src/hooks/useKdsView.ts,frontend/src/components/kds/KdsWorkspace.tsx, andfrontend/src/components/layout/Sidebar.tsxas raw text and regex-match implementation strings (const viewMode = override ?? serverDefault ?? 'kanban',setViewMode(nextView); conn.persistViewMode?.(nextView);, andwindow.setTimeout(...)). Replace these source-string regex checks with executable behavioral assertions (for example, renderingKdsWorkspaceviarenderWithIntlwithserverDefault={null}andserverDefault="tabs"and asserting the rendered Kanban/Tabs view output alongside the executableclearStaleBodyPointerEventschecks).frontend/src/hooks/use-confirm.tsx:27-clearStaleBodyPointerEvents()infrontend/src/hooks/use-confirm.tsx:27and its duplicated inline implementation infrontend/src/components/layout/AuthGuard.tsx:86-102only check for open[data-slot="dialog-content"]and[data-slot="dropdown-menu-content"]elements, omitting Radix-backed[data-slot="sheet-content"][data-state="open"]and[data-slot="drawer-content"][data-state="open"]overlays that also setdocument.body.style.pointerEvents = 'none'. If a component inside an openSheetorDrawermounts or closesuseConfirm(),clearStaleBodyPointerEvents()prematurely clearsdocument.body.style.pointerEventswhile the sheet or drawer remains open. Includesheet-contentanddrawer-contentinclearStaleBodyPointerEvents()and callclearStaleBodyPointerEvents()directly fromAuthGuard.tsxinstead of duplicating the DOM query.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run test:kds-contractnpm run test:kds-integrationnpm run test:ui-regressions-621-623-626npm run test:rtl-kds-server-whatsappnpm run test:migration-registrynpm run test:schema-healthnpm run test:upgrade-pathnpm run test:authorization-permissionsnpm run docs:checknpm run build && npm run build:frontendCI=1 E2E_BASE_URL=http://127.0.0.1:43001 E2E_KDS_BASE_URL=http://127.0.0.1:43002 E2E_SERVER_APP_BASE_URL=http://127.0.0.1:43003 npx playwright test e2e/kds-login.spec.ts --config=playwright.config.ts --project=chromium --retries=0✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.