Skip to content

Conversation

jonkafton
Copy link
Contributor

@jonkafton jonkafton commented Oct 10, 2025

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/8869

IMPORTANT: The URL added is https://learn.mit.edu/dashboard/organization, not /dashboard/organizations as requested in the issue. This fits our current path segment name and we are taking the user to a single organization, but can add a route for /dashboard/organizations if it's a specific requirement

Description (What does it do?)

Provides a dashboard organization landing route, /dashboard/organization, that will navigate the user to their organization. This allows a single URL. http://learn.mit.edu/dashboard/organization for all users.

User loads /dashboard/organization:

  • If they have one or more organizations, they are navigated to their last visited or the first in the b2b_organizations array.
  • If they have no organizations, they are navigated to their dashboard home (/dashboard).

Shows a not found screen at /dashboard/organization/slug-no-exist. Shown with the dashboard navigation, as we don't necessarily want to take them out of the dashboard.

Screenshots (if appropriate):

How can this be tested?

With MITxOnline set up locally and integrated with Learn and ideally 2 or more organizations set up for your test user. Check @ChristopherChudzicki's detailed instructions, up to setting your test user to be part of the org: #2569

Additional Context

Session storage is used to select the org to navigate to, so will only work on same machine and browser. The b2b_organization array is not sorted on the API, so are likely returned in the db insertion order (b2b contract creation, not user/contract relationship). We're selecting the first one. We do also have the contract start/end dates on the API, though these are nullable.

@ChristopherChudzicki ChristopherChudzicki self-assigned this Oct 10, 2025
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

One request re separating things.

Mostly unrelated to this PR, I think we should fetch mitxonline user data much earlier.. Like, on page load. Or maybe as part of RestrictedRoute, since restricted routes are very likely to use the mitxonline data.

Comment on lines +461 to +465
if (isLoadingMitxOnlineUser || !mitxOnlineUser || !orgSlug) {
return (
<Skeleton width="100%" height="100px" style={{ marginBottom: "16px" }} />
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since no longer trying to get this out today, I think it is worth having separate components for

  1. /dashboard/organizations redirect logic + this small skeleton
  2. /dashboard/organizations/:slug org display + (including error page for org not found)

You mentioned an empty loading page being odd, but I don't think the separation affects that? Currently, everything below the skeleton only runs when the slug is provided in the URL, and everything above is redirecction related.

I tried to emulate the above situation by changing the final return to

return orgSlug ?  <OrganizationContentInternal org={b2bOrganization} /> : null

and I didn't notice any difference.

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