Skip to content

feat: add homeApp to redirect / to the dashboard#8

Merged
arbrandes merged 1 commit intoopenedx:mainfrom
arbrandes:home-redirect
Mar 19, 2026
Merged

feat: add homeApp to redirect / to the dashboard#8
arbrandes merged 1 commit intoopenedx:mainfrom
arbrandes:home-redirect

Conversation

@arbrandes
Copy link
Copy Markdown
Contributor

Description

Add an inline homeApp that registers a route at / and redirects to the learner dashboard via getUrlByRouteRole, shared across both dev and build site configs. If the dashboard role isn't found, nothing is rendered.

LLM usage notice

Built with assistance from Claude models (mostly Opus 4.6).

src/homeApp.tsx Outdated
if (dashboardUrl) {
return <Navigate to={dashboardUrl} replace />;
}
return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's no dashboard for any kind of reason, wouldn't it be better to lead them to a 404?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. That is exactly what's going to happen since we merged openedx/frontend-base#194: there's no default '/' route. 👍🏼

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Or, at least, that's what should happen given the config.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that PR uses useRouteError right? which is expecting an error so the error boundary does it's magic, and in this case we return null here when there's no dashboardUrl and the getUrlByRouteRole it's going to return either the route for a frontend base component or an external route or null

which means there's a case we just sho a null component with no error right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're completely right. Obviously (in retrospect), we need to throw the error, otherwise the boundary won't catch it. Fixed!

Adds an inline app that redirects the root route to the learner
dashboard via getUrlByRouteRole, shared across dev and build configs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@arbrandes arbrandes merged commit 7dfd7d4 into openedx:main Mar 19, 2026
2 checks passed
@arbrandes arbrandes deleted the home-redirect branch March 19, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants