-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
8966e8f
to
b57c481
Compare
@@ -0,0 +1,72 @@ | |||
import React, {useEffect} from 'react'; |
There was a problem hiding this comment.
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 & { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
0cb5b73
to
d9525c9
Compare
@@ -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'; |
There was a problem hiding this comment.
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
45df849
to
385171d
Compare
385171d
to
a8b8f23
Compare
a8b8f23
to
cbcc979
Compare
cbcc979
to
c2ea0f5
Compare
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.