Skip to content

Core 1039 improve portal routing #2750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Jun 25, 2025

CORE-1039
By examining the data from the CMS to determine what kind of page was being requested, I was able to get rid of the fallback process.

@RoyEJohnson RoyEJohnson force-pushed the core-1039-improve-portal-routing branch from 8966e8f to b57c481 Compare June 25, 2025 14:37
@@ -0,0 +1,72 @@
import React, {useEffect} from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were largely extracted from router.js

import {ImportedPage} from './page-loaders';
import {RouteAsPortalOrNot} from './portal-page-routes';

type PageData = FlexPageData & {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is the bulk of the new routing process.

import {ImportedPage} from './page-loaders';

// eslint-disable-next-line complexity
export function RouteAsPortalOrNot() {
Copy link
Contributor Author

@RoyEJohnson RoyEJohnson Jun 25, 2025

Choose a reason for hiding this comment

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

This file is the rest of the new routing process. I punted it back to JS because the tests were failing in strange and inscrutable ways (and JS files are exempt from the 100% coverage rule)

@@ -0,0 +1,95 @@
import React, {useEffect} from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What was left in router.js is now TS.

const loaders = {
default: () => import('~/layouts/default/default'),
landing: () => import('~/layouts/landing/landing')
};

type LayoutParameters = {
name: LayoutName;
name: LayoutName | null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To prevent flashing from one layout to another, I allow a null LayoutName.

@RoyEJohnson RoyEJohnson force-pushed the core-1039-improve-portal-routing branch 5 times, most recently from 0cb5b73 to d9525c9 Compare June 25, 2025 18:05
@@ -7,17 +7,17 @@ import useMainClassContext, {
import useLanguageContext from '~/contexts/language';
import ReactModal from 'react-modal';
import cn from 'classnames';
import { LinkFields } from '../../pages/flex-page/components/Link';
import {LinkFields} from '../../pages/flex-page/components/Link';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes here are just due to prettier

@RoyEJohnson RoyEJohnson force-pushed the core-1039-improve-portal-routing branch 2 times, most recently from 45df849 to 385171d Compare June 25, 2025 19:36
@RoyEJohnson RoyEJohnson requested a review from TomWoodward June 25, 2025 19:38
@RoyEJohnson RoyEJohnson force-pushed the core-1039-improve-portal-routing branch from 385171d to a8b8f23 Compare July 8, 2025 16:08
@RoyEJohnson RoyEJohnson force-pushed the core-1039-improve-portal-routing branch from a8b8f23 to cbcc979 Compare July 14, 2025 15:52
@RoyEJohnson RoyEJohnson force-pushed the core-1039-improve-portal-routing branch from cbcc979 to c2ea0f5 Compare July 15, 2025 20:16
@RoyEJohnson RoyEJohnson requested a review from jivey July 15, 2025 20:29
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.

1 participant