whisper-money/resources/js
Víctor Falcón 22952c4e75
fix(cashflow): read period from server props instead of window (#302)
## Summary
- Fixes
[PHP-LARAVEL-9](https://whisper-money.sentry.io/issues/PHP-LARAVEL-9):
`ReferenceError: window is not defined` during Inertia SSR of
`CashflowPage`.
- `CashflowController` now reads + validates the `period` query param
(`YYYY-MM`) and passes it as an Inertia prop.
- Client `useState` initializer reads from `usePage().props.period`
instead of `window.location.search`, making SSR safe and avoiding
hydration mismatch.
- `useEffect` URL sync now compares against the prop, not
`window.location.search`.

## Why (c) not a `typeof window` guard
Server-provided params avoid hydration mismatch and keep URL as single
source of truth.

## Tests
New `tests/Feature/CashflowPageTest.php`:
- guest redirect
- no query param → `period` prop `null`
- valid `?period=2025-03` → prop `'2025-03'`
- invalid value → `null`
- malformed format (`2025-3`) → `null`

All 5 pass (50 assertions).

## Scope
Cashflow only. Other pages with similar `window.location.search` in
`useState` initializers (`onboarding/index.tsx`, `welcome.tsx`,
`auth/login.tsx`) left for follow-up.

Fixes PHP-LARAVEL-9
2026-04-17 10:27:49 +01:00
..
components feat(open-banking): remove feature flag gating (#297) 2026-04-17 10:20:05 +02:00
contexts Move transaction filtering from client-side to server-side (#126) 2026-02-16 12:49:04 +01:00
hooks feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
layouts feat(open-banking): remove feature flag gating (#297) 2026-04-17 10:20:05 +02:00
lib feat(accounts): add real estate asset tracking (#241) 2026-03-24 10:21:32 +00:00
pages fix(cashflow): read period from server props instead of window (#302) 2026-04-17 10:27:49 +01:00
providers chore: Change mobile menu translation on spanish (#268) 2026-04-10 13:46:26 +01:00
services feat: Decrypt encrypted transactions on key unlock (#123) 2026-02-16 10:37:43 +01:00
types feat(open-banking): remove feature flag gating (#297) 2026-04-17 10:20:05 +02:00
utils fix: preserve cents in chart amounts (#270) 2026-04-10 15:41:24 +02:00
app.tsx fix(user): persist detected timezones (#296) 2026-04-16 11:36:57 +01:00
ssr.tsx Remove plaintext-transactions feature flag & E2E references (#116) 2026-02-13 11:10:21 +01:00