Repository navigation
Open
Copy link
Description
An app that declares a route for a role always wins over the site's externalRoutes for that role, so a site cannot send a role an installed app declares to a destination of its own. Found while planning to move Learning's tab links onto route roles (openedx/frontend-app-learning#2190, part of #1905): once it does, an operator who wants Learning's dates or outline link to go somewhere else has no way to say so.
Note
The details below were generated by Claude (Claude Code) and reviewed before posting.
Claude Plan
How a role resolves today
getUrlByRouteRolewalkssiteConfig.appsin list order and each app's route tree depth-first, and returns the first route whosehandle.rolesincludes the role. Only when no app declares the role does it readsiteConfig.externalRoutes, again first match. There is no check for a second match and no warning, so when two apps declare the same role the one listed first inappswins silently, and an external route for a role any app declares is never consulted.resolveRouteByRoleandgetLinkPropsbuild on it, so every link resolved through a role follows the same order.ExternalRouteis a role and a URL; nothing on it or on the site config says it should take precedence.
What the docs say
- The migration guide's URL Config changes: URLs "should now be expressed as part of the
appsconfig as route roles, or asexternalRoutes, and resolved in code viaresolveRouteByRole()". It names both sources and does not say what happens when both declare a role.
Where it bites
- Learning declares
org.openedx.frontend.role.courseDates,courseOutlineandcourseProgresson its routes, which it must for the shell's course bar. Its progress tab is to link to the dates and outline tabs through those roles (Port the progress tab to frontend-base frontend-app-learning#2190). A site that then wants one of those links to go elsewhere cannot express that in site config: an external route for the role is never reached while Learning is installed. - The same holds for any app that declares a role for a page it serves and any site that wants to point that role elsewhere.
Questions
- Should a site be able to override an installed app's route for a role with a destination of its own, without uninstalling the app?
- If so, how does the site say so?
- Should the resolver report when two sources declare the same role?
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity