Skip to content

fix(site): full-period range ("Hele perioden") on /arbeidsmarked + un-grey "max" - #201

Merged
Oscar-west merged 2 commits into
mainfrom
fix/arbeidsmarked-hele-perioden-range
Sep 10, 2026
Merged

Oscar-west merged 2 commits into
mainfrom
fix/arbeidsmarked-hele-perioden-range

Conversation

@Oscar-west

Copy link
Copy Markdown
Contributor

What

On /arbeidsmarked the only selectable time-range was 1 mnd — 6 mnd, 1 år, Siden 2024 and Maks were all greyed with "Ikke nok data ennå", so there was no way to view the full collected period.

Root cause: unavailableRanges() greys ranges whose trailing window reaches before the earliest data (they'd render identically to max). But rangeCutoffMs("max") is -Infinity, which always sorts before earliestMs — so the helper greyed max itself. On /arbeidsmarked (data only since the 2026-04-13 cutoff, so every finite window predates it) that left one option. The bug was masked on /media and /offentlig because they still have 1 år/Siden 2024 live.

Changes

  • range.ts — exempt max from unavailableRanges() (one-line root-cause fix). Also restores the Maks option on /media, /offentlig, /oppstart — e.g. /offentlig regains a real 2019→now view.
  • arbeidsmarked/_components/scroller.tsx — drop the always-greyed finite ranges from the jobs toggle and relabel max → "Hele perioden" (reuses the toggle's existing options prop; no new Range value). As live data accumulates past the cutoff, 6m/1år reappear on their own.
  • range.test.ts — new regression test: max never greyed; young-pillar (/arbeidsmarked) vs old-pillar (/offentlig) horizons; non-finite horizon.

Verification

pnpm typecheck ✓ · pnpm lint:postgrest ✓ · pnpm test (330 ✓, incl. 5 new) · pnpm build ✓ — the four CI gates, all green locally.

Scoped to my three files only; the branch's other WIP is not included.

🤖 Generated with Claude Code

Oscar-west and others added 2 commits September 10, 2026 15:00
…ioden" on /arbeidsmarked

unavailableRanges() greyed out "max" itself — its -Infinity cutoff always
sorts before earliestMs — so on /arbeidsmarked, where every finite trailing
window also predates JOBBMARKED_DATA_CUTOFF, the only selectable range was
"1 mnd". Exempt "max" from greying; it is the full-dataset reference every
other range is compared against and must never grey itself. This also restores
the "Maks" option on /media, /offentlig and /oppstart, where the same bug was
masked by their longer-reaching data.

On /arbeidsmarked, drop the always-greyed finite ranges (6m/1år/Siden 2024)
from the toggle and relabel "max" as "Hele perioden" — the full collected
period. As live NAV data accumulates past the cutoff, those ranges reappear on
their own.

Add range.test.ts as the regression guard (max never greyed; young-pillar vs
old-pillar horizons; non-finite horizon).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The previous commit staged the whole arbeidsmarked scroller, which carried an
uncommitted `definition` prop on <PillarHero> that depends on a pillar-hero.tsx
change not in this PR — so CI typecheck failed against main. Remove it here; the
WIP prop stays uncommitted in the working tree, untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Oscar-west
Oscar-west merged commit ced16fc into main Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant