* fix(vat): momsdeklaration defaults respect the configured cadence and persist manual changes
The period picker re-seeded from scratch on every visit: an arsmoms user
whose moms_period was never set landed on a silently guessed quarterly
declaration (companies without a company_settings row bypassed every
gate), and a manually chosen cadence evaporated on the next visit.
- Gate the view when no company_settings row exists, matching the
existing "registered but no period" gate: a declaration for the wrong
period type is a compliance hazard, not a convenience.
- Persist the manually chosen cadence per company (localStorage,
FyPicker pattern) and restore it while moms_period is unchanged; the
concrete period still re-seeds to the most recently ended one, and a
changed setting discards the stored cadence.
- Extract the seeding decision into lib/vat/period-selection.ts with
unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pQn9kC742B9R7Ggi8wdn9
* fix(vat): drop cadence persistence; the moms_period re-seed is the control
Skeptic review refuted the persistence half of the previous commit twice:
the render-phase localStorage restore diverged from SSR (hydration error
on every visit once a cadence was stored), and restoring a manually
chosen cadence that deviates from moms_period kept the filing pipeline
open on the wrong period type across visits, with no downstream path
validating period type against the setting.
The redovisningsperiod has exactly one lawful value per company, so the
mount-time re-seed from company_settings.moms_period is the self-healing
control, not a bug. The settings-row gate and the extracted, tested
seeding resolver stay.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pQn9kC742B9R7Ggi8wdn9
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>