-
Notifications
You must be signed in to change notification settings - Fork 364
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-8783] - Migrate /volumes to Tanstack Router #11154
Conversation
870fa9c
to
b51f8da
Compare
1ba4b04
to
071f12f
Compare
@@ -56,7 +56,7 @@ export const EditVolumeDrawer = (props: Props) => { | |||
values, | |||
} = useFormik({ | |||
enableReinitialize: true, | |||
initialValues: { label: volume?.label, tags: volume?.tags }, | |||
initialValues: { label: volume?.label ?? '', tags: volume?.tags ?? [] }, |
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.
avoids console error (uncontrolled to controlled input)
// params: { linodeId: volume.linode_id }, | ||
// search: { upgrade: 'true' }, | ||
// to: '/linodes/$linodeId/storage', | ||
// }); |
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.
Important
We can't use Tanstack router's navigate()
to route to a feature that has not been migrated to the new routing. This will result in a browser crash. In this case we will keep the react-router-dom
history.push
till /linodes/*
routes are served by the new router
@@ -26,7 +26,8 @@ export const gettingStartedGuides: ResourcesLinkSection = { | |||
}, | |||
{ | |||
text: 'Create and Manage Block Storage Volumes', | |||
to: 'https://techdocs.akamai.com/cloud-computing/docs/block-storage', | |||
to: | |||
'https://techdocs.akamai.com/cloud-computing/docs/manage-block-storage-volumes', |
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.
unrelated, doc link was just wrong
@@ -108,7 +108,7 @@ export const makePaginatedResponse = <T extends JsonBodyType>({ | |||
typeof item === 'object' && | |||
item !== null && | |||
key in item && | |||
String(item).toLowerCase().includes(searchValue) | |||
String(item[key]).toLowerCase().includes(searchValue) |
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 fix to make the filtering work when using CRUD MSW (volumes are supported)
@@ -8,4 +9,12 @@ export type RouterContext = { | |||
isACLPEnabled?: boolean; | |||
isDatabasesEnabled?: boolean; | |||
isPlacementGroupsEnabled?: boolean; | |||
queryClient: QueryClient; |
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 need this new react-query context to be able to inspect the cache to validate the entity the router is navigating to.
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.
Note: it is not used in this PR but will be used in features that can use prefetching at the route level
aa049fb
to
2f88aae
Compare
Coverage Report: ✅ |
When a user requests a page number that exceeds our available pages (e.g., ?page=100), should we:
|
2f88aae
to
7572630
Compare
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.
Thanks for tackling this, looking really good.
- Nit: After clearing the search, the URL still includes an empty query parameter
/volumes?query=
We should look into cleaning this up since it gets appended for subsequent routes, IE:/volumes/1320163/details?query=
94d206f
to
b365c6c
Compare
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.
Leaving a couple comments and minor suggestions. Will leave a true review once this PR is in its final state.
packages/manager/cypress/e2e/core/volumes/create-volume.smoke.spec.ts
Outdated
Show resolved
Hide resolved
packages/manager/src/components/InlineMenuAction/InlineMenuAction.tsx
Outdated
Show resolved
Hide resolved
Converting this to draft in order to avoid too much feedback based on things being in flux because of reworking parts of the dialog routing from early comments |
@abailly-akamai for future reference, we should make it clear as early as possible when a PR is in an incomplete state. Reviewing 1000+ line PRs is a time-intensive effort and I didn't realize I was reviewing non-finalized changes until I was most of the way through my review. |
@hkhalil-akamai Apologies, you are right, should had done it earlier - addressing feedback and this PR is still in shape so it's tricky - It must be noted your feedback was very valuable |
d7524d0
to
afaaa1d
Compare
Cloud Manager UI test results🎉 467 passing tests on test run #60 ↗︎
|
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.
✅ back and forth for order by working
✅ confirmed behavior of other items - pagination, search, actions, etc
thanks Alban!
Description 📝
This PR implements our new routing to
/volumes
🎉Beyond replicating functionalities, it also switches to using params for dialogs (modals & drawers) for the whole feature.
While being a tad more involved in terms of development, the benefits are quite great:
An overview of how this works
Changes 🔄
/volumes
usePagination
anduserOrder
to use the new router methodsHow to test 🧪
Verification steps
note: you can use
prod-test-029
to test with an account with many volumesTry to break things!
As an Author I have considered 🤔
Check all that apply