Function
Optionalprofiles: LearnerProfileRepositoryOverrides the profile storage adapter; tests inject a stub
Course routes are rendered in full on the server, so crawlers and share previews keep their content; the decision is made here, after hydration, once storage has been read. Nothing happens while the profile is unknown, and the redirect replaces the history entry — see useLearnerRedirect.
Sends a device without a learner profile from a course route to the onboarding, remembering the route so the onboarding can return to it.