fix(frontend): restore PublicView back-compat for tests + CI
Build & Push Docker Images / test-backend (push) Failing after 18s
Build & Push Docker Images / test-frontend (push) Successful in 22s
Build & Push Docker Images / build-backend (push) Has been skipped
Build & Push Docker Images / build-frontend (push) Has been skipped
Build & Push Docker Images / test-backend (push) Failing after 18s
Build & Push Docker Images / test-frontend (push) Successful in 22s
Build & Push Docker Images / build-backend (push) Has been skipped
Build & Push Docker Images / build-frontend (push) Has been skipped
The lifted screen-state refactor in PublicView broke App.test.jsx (5
failures): when no `onScreenChange` prop was passed, the click handler
called a no-op, so the screen never advanced from 'home' to 'search'
and the search input was never rendered.
Fix: make screen state uncontrolled-by-default. PublicView owns its
own `useState('home')` and uses the lifted props only when App.jsx
provides them. Same back-compat shape as before, BottomNav still
drives the screen via controlled props in the real app.
Also: vitest defaults to watch mode, which hangs the CI test step
forever. Updated docker.yaml to pass `--run --reporter=basic` so the
job exits with a real pass/fail signal.
Local verification: `npm test -- --run` → 6/6 passing.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,11 @@ function PublicView({
|
||||
screen: screenProp,
|
||||
onScreenChange,
|
||||
}) {
|
||||
// ponytail: screen state lifted to App.jsx so BottomNav can switch directly.
|
||||
const screen = screenProp ?? 'home';
|
||||
const setScreen = onScreenChange ?? (() => {});
|
||||
// ponytail: uncontrolled by default (own state); controlled when App.jsx passes props
|
||||
// so BottomNav can drive the inner screen directly. No-op fallback breaks tests.
|
||||
const [internalScreen, setInternalScreen] = useState('home');
|
||||
const screen = screenProp ?? internalScreen;
|
||||
const setScreen = onScreenChange ?? setInternalScreen;
|
||||
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [medicines, setMedicines] = useState([]);
|
||||
|
||||
Reference in New Issue
Block a user