Learn > Home redirects to Library when no channels are on the device, hiding a learner's classes
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
HomePageredirects to Learn > Library wheneverfetchChannels()returns no locally available channel (kolibri/plugins/learn/frontend/views/HomePage/index.vue:232), before any class data is rendered.- It fires for a learner enrolled in a class with an active lesson, so the class is never shown.
YourClassesis rendered only byHomePage, so once Home redirects nothing in the UI links to the class list.
Errors and logs
Nothing is logged — the redirect is client-side and the class data is present. Replaying the LOD home attached to #15217 QA:
sqlite3 db.sqlite3 "select count(*) from content_channelmetadata" -> 0
GET /learn/api/state -> {"classrooms": [{"name": "AA", "lessons": [{"title": "Lek2F", "active": true, …}]}], …}
Expected behavior
A signed-in learner enrolled in a class lands on Learn > Home and sees the class, whether or not a channel is locally available.
User-facing consequences
- A learner imported onto a learn-only device cannot reach their classes or assignments until content is imported there — the class list is reachable only by typing
/learn/#/home/classes. - The records are all present, so it reads as a failed sync.
Steps to reproduce
- Set up a learn-only device and import a learner who is enrolled in a class with an active lesson. Import no channels.
- Sign in as that learner and open Learn.
- Home replaces itself with Library and the class is never listed, while
GET /learn/api/statereturns it.
Context
- Found by @radinamatic during QA of #15217, on an Ubuntu LOD importing from a Kolibri 0.18.4 peer. Kolibri 0.20.0a2.dev97+gb5c77e5e7, Chrome 151.
- Redirect added in ea540cd542 (2023-09-05).
Acceptance Criteria
- [ ] A signed-in learner with a class membership and no locally available channels lands on Learn > Home with the class listed.
- [ ] A signed-in learner with no class membership and no channels still lands on Library.
- [ ] A frontend test covers Home with zero channels and one class membership.
AI usage
Claude Code found and filed this while working PR #15217. The symptom came from @radinamatic's QA of that PR; I confirmed the cause by replaying the learn-only device home they attached — the class and its active lesson come back from /learn/api/state, the device has no channel rows — and by reading the Home page's channel guard.
Confirmed end to end during QA of #15217 (@radinamatic, on a LOD imported from a 0.18.4 peer): with zero channel rows the learner's Learn > Home bounced to Library, while /learn/api/state on that same home returned classroom AA with active lesson Lek2F. Importing one channel made the class and its assignments appear immediately — no other change.
That matches the guard at kolibri/plugins/learn/frontend/views/HomePage/index.vue:232: fetchChannels() empty replaces the route with Library before YourClasses can render.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
Plan: A signed-in learner enrolled in a class lands on Learn > Home and sees the class, even when the device has no locally available channel.
- [ ] Keep Home for a class-enrolled learner on a channel-less device
- [ ] Self-review the produced code
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output