-
Notifications
You must be signed in to change notification settings - Fork 367
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: [M3-9053] - Reroute Longview #11490
Changes from all commits
d78c9fb
42550c6
efbdafa
b965fcc
ff6aca3
f910596
45f3f7b
910b088
53efb3f
6c0e420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,7 @@ module.exports = { | |
// for each new features added to the migration router, add its directory here | ||
'src/features/Betas/**/*', | ||
'src/features/Domains/**/*', | ||
'src/features/Longview/**/*', | ||
'src/features/Volumes/**/*', | ||
], | ||
rules: { | ||
|
@@ -119,14 +120,20 @@ module.exports = { | |
'withRouter', | ||
], | ||
message: | ||
'Please use routing utilities from @tanstack/react-router.', | ||
'Please use routing utilities intended for @tanstack/react-router.', | ||
name: 'react-router-dom', | ||
}, | ||
{ | ||
importNames: ['renderWithTheme'], | ||
importNames: ['TabLinkList'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now need to make sure to use TanStackTabLinkList.tsx for Tabs under the tanstack routing Eventually those "Tanstack" naming conventions will be going away, however for the time of the migration it si very helpful for utils and components to be semantically dissociated. |
||
message: | ||
'Please use the wrapWithThemeAndRouter helper function for testing components being migrated to TanStack Router.', | ||
name: 'src/utilities/testHelpers', | ||
'Please use the TanStackTabLinkList component for components being migrated to TanStack Router.', | ||
name: 'src/components/Tabs/TabLinkList', | ||
}, | ||
{ | ||
importNames: ['OrderBy', 'default'], | ||
message: | ||
'Please use useOrderV2 hook for components being migrated to TanStack Router.', | ||
name: 'src/components/OrderBy', | ||
}, | ||
], | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Link as TanstackLink } from '@tanstack/react-router'; | ||
import * as React from 'react'; | ||
|
||
import { Tab } from 'src/components/Tabs/Tab'; | ||
import { TabList } from 'src/components/Tabs/TabList'; | ||
|
||
import type { Tab as TanstackTab } from 'src/hooks/useTabs'; | ||
|
||
export interface Tab { | ||
chip?: React.JSX.Element | null; | ||
routeName: string; | ||
title: string; | ||
} | ||
|
||
interface TabLinkListProps { | ||
noLink?: boolean; | ||
tabs: TanstackTab[]; | ||
} | ||
|
||
export const TanStackTabLinkList = ({ noLink, tabs }: TabLinkListProps) => { | ||
return ( | ||
<TabList> | ||
{tabs.map((tab, _index) => { | ||
return ( | ||
<Tab | ||
// @ts-expect-error - Tab accepts 'as' prop at runtime but it's not in the types | ||
as={noLink ? undefined : TanstackLink} | ||
key={`tab-${_index}`} | ||
preload={noLink ? undefined : 'intent'} | ||
to={noLink ? undefined : tab.to} | ||
> | ||
{tab.title} | ||
{tab.chip} | ||
</Tab> | ||
); | ||
})} | ||
</TabList> | ||
); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is essentially a copy of the old one except it uses the new Link under the hood I made a new one to avoid going into a Typescript whack-a-mole |
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.
A lot of test are just fine to keep running with
renderWithTheme
- only the ones relying on some form of routing need to start usingrenderWithThemeAndRouter