-
Notifications
You must be signed in to change notification settings - Fork 30
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
refactor(components): lazy load custom view selector in modular tab components #3691
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 68d5b82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const { currentCustomViewLocatorCode } = useCustomViewLocatorSelector( | ||
props.customViewLocatorCodes | ||
); |
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.
We are now using the hook here to match the router location
if (typeof window !== 'undefined' && typeof window.app !== 'undefined') { | ||
return import( | ||
'./custom-views-selector' /* webpackChunkName: "custom-views-selector" */ | ||
); | ||
} | ||
return Promise.resolve({ default: () => 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.
Here we evaluate if the component should be lazy loaded or not, by relying on window.app
being defined
export type TCustomViewLocatorCodeLocationDescriptor = { | ||
pathname?: string; | ||
search?: string; | ||
}; |
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.
Instead of using the type LocationDescriptor
from history
, we define our own similar type.
cd2f282
to
68d5b82
Compare
Main goals:
window.app
is defined)