ENGLISH·COURSE API
    Preparing search index...
    • Reads the learner's progress through a module as a route.

      Parameters

      • lessons: readonly RouteLesson[]

        The module's lessons with their runtimes

      Returns ModuleRouteReading

      The route once progress and the record are read, otherwise { isRead: false }

      Completion, playback position and the continue-watching record live in localStorage, which the server cannot read. The record is read through an asynchronous port, so the hook reports isRead: false until it arrives: the featured lesson depends on it, and deriving the route from progress alone first would feature one lesson and then move to another. The initial state matches the server render, so hydration never sees a mismatch.

      A missing or unreadable record reads as "no lesson opened last", and the route falls back to the furthest progress. Once read, the route re-derives whenever the completion or playback store changes.

      const reading = useModuleRoute(lessons);
      if (!reading.isRead) return <RouteWithoutProgress lessons={lessons} />;
      return <Route steps={reading.route.steps} />;