testsAndMisc/kcd2_dice_solver/src
Krzysztof kuhy Rudnicki 44b8b79207 Split kcd2 App.tsx 306 -> 217 + useInventoryState
App.tsx owned the inventory as well as rendering it: resolving a shared link
against this browser's storage at mount, deferring persistence until the
visitor consents, clearing the URL fragment, and three mutators. Moved all of
it to a useInventoryState hook (163) beside the existing useSolver.

The two inline handlers that only set state became named keep/replace
callbacks, so the view no longer touches setPersist or setSaved; Clear,
Discard and onImport all go through replace.

Coverage held at 100% -- totals moved 863/375/181/810 -> 864/375/182/811,
exactly the one statement and one function that promoting the Keep handler
adds. Branches unchanged, so nothing conditional left test reach. That was
the metric that would have caught an over-large extraction here, since the
hook has no dedicated test and rides on the four App test files.

No kcd2_dice_solver file is over the 250-line cap now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 09:46:49 +02:00
..
components Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
core Split kcd2 badgeValue.ts 334 -> 172 + baseline 2026-08-17 09:43:06 +02:00
data Split the kcd2_dice_solver data tables under the cap 2026-08-16 19:50:54 +02:00
hooks Split kcd2 App.tsx 306 -> 217 + useInventoryState 2026-08-17 09:46:49 +02:00
lib Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
test Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
worker Track kcd2_dice_solver app and add run.sh dependency installer 2026-07-21 18:17:13 +02:00
App.tsx Split kcd2 App.tsx 306 -> 217 + useInventoryState 2026-08-17 09:46:49 +02:00
AppLinks.test.tsx Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
AppRecovery.test.tsx Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
AppShell.test.tsx Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
AppStorage.test.tsx Split the kcd2_dice_solver test files under the cap 2026-08-16 20:03:33 +02:00
index.css kcd2 dice solver: serve it at dice.kuhy.duckdns.org, fit all 43 dice, move inventories between devices 2026-07-26 20:01:21 +02:00
main.tsx Track kcd2_dice_solver app and add run.sh dependency installer 2026-07-21 18:17:13 +02:00