Function
Optionalrepository: ContinueWatchingRepositoryOverrides the adapter; tests inject a fake here
get resolving to the most recent location (or null), list
resolving to one record per course (latest first), and set
resolving to whether the value passed validation and persisted
This hook is the client's composition root for the continue-watching
record — the one place allowed to name a concrete adapter, the same role
usePlaybackPosition plays for playback and the learner
dependencies play on the server. Everything downstream of it
sees only the ContinueWatchingRepository port.
Writes are validated by the ContinueWatchingLocation value object first,
so a route triple assembled from a malformed URL segment is never saved. A rejected write reports false rather than throwing: failing to
remember where the learner was is not worth breaking the page they are on.
Reads go straight to the port rather than through a use case. There is no domain decision to make — an absent record and a corrupt one are both simply "nothing to continue", which the adapter already collapses.
The returned object is memoized on the repository, so consumers can list
it in a useEffect dependency array without re-recording on every render.
Browser-side only — do NOT call from a Server Component or Server Action.
Client hook: reads and writes where the learner was in each course.