-
Notifications
You must be signed in to change notification settings - Fork 373
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-9080] - Tanstack routing for VPCs #11906
base: develop
Are you sure you want to change the base?
Conversation
buncha eslint import sort fixes step 6 save progress
save more progress? save more progress
…unassign drawer now
@@ -318,47 +385,54 @@ export const VPCSubnetsTable = (props: Props) => { | |||
TableRowHead={SubnetTableRowHead} | |||
/> | |||
<PaginationFooter | |||
count={subnets.data?.length || 0} | |||
count={subnets.results || 0} |
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.
fixes bug for subnet pagination
@@ -61,7 +61,7 @@ export const SubnetCreateDrawer = (props: Props) => { | |||
setError, | |||
watch, | |||
} = useForm<CreateSubnetPayload>({ | |||
defaultValues: { | |||
values: { |
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.
fixes bug for IP incrementation
const handleEditVPC = (vpc: VPC) => { | ||
navigate({ | ||
params: { action: 'edit', vpcId: vpc.id }, | ||
to: '/vpcs/$vpcId/details/$action', | ||
}); | ||
}; | ||
|
||
const handleDeleteVPC = (vpc: VPC) => { | ||
navigate({ | ||
params: { action: 'delete', vpcId: vpc.id }, | ||
to: '/vpcs/$vpcId/details/$action', | ||
}); | ||
}; |
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.
VPC Details was interesting to refactor, and I'm not sure about all the decisions I made
Here:
- we have edit/delete dialogs on the detail page itself + we fetch the VPC, so I currently went with not using dialog data for VPC in details. In terms of error handling, if we're unable to get the VPC, we remain on the VPC's detail page and display the following error below. Should we reroute to the
/vpcs
landing page instead?
if (!vpc || error) {
return (
<ErrorState errorText="There was a problem retrieving your VPC. Please try again." />
);
}
- I have different routes for the edit/delete dialogs on the landing vs details page. Otherwise clicking Edit/Delete on the details page would take us to the landing page
- landing edit/delete routes for comparison:
- /vpcs/$vpcId/edit
- /vpcs/$vpcId/delete
- landing edit/delete routes for comparison:
packages/manager/src/features/VPCs/VPCDetail/VPCSubnetsTable.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/VPCSubnetsTable.tsx
Outdated
Show resolved
Hide resolved
// If the user initiates a history -/+ to complete a linode action and the linode | ||
// is no longer assigned to a subnet, push navigation to the vpc's detail page | ||
React.useEffect(() => { | ||
if (subnets && selectedSubnet) { | ||
const updatedSubnet = subnets.data.find( | ||
(subnet) => subnet.id === selectedSubnet.id | ||
); | ||
setSelectedSubnet(updatedSubnet); | ||
if (params.linodeAction && !selectedLinode) { | ||
navigate({ | ||
params: { vpcId }, | ||
to: VPC_DETAILS_ROUTE, | ||
}); |
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.
(see selected subnet comment above)
I've currently kept the selected Linode in a useState, so it has the same issue as mentioned above ^. Thinking about switching to useDialogData
, but may still have to keep the useEffect - the Linode actions here don't delete the Linode, so useDialogData
won't time out
update: using useDialogData for this as well now + a useEffect that determines if the selected Linode no longer exists in the selectedSubnet
putting this up for initial review, but likely will be returning it to a draft state based on feedback on ^ items (and other stuff as found) @abailly-akamai would appreciate your thoughts on this! |
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.
Alight, fixed the useDialogData
hook to handle a secondary argument. Hopefully this will work as we want!
Will do a deeper review once some changes and cleanup discussed during pair programming are addressed.
Great work so far tho, this is looking solid as a 🪨
thanks Alban! will get to the changes we discussed sooner rather than later, and then re-request you |
alrighty should be in a better state now! |
Cloud Manager UI test results🎉 534 passing tests on test run #10 ↗︎
|
Note
I see some VPC related work coming in, so hopefully I'm putting this up early enough to not interrupt VPC stuff. If not, I can def close this and come back to it at a later time
I also have a few questions/stuff I'm unsure of for this refactor, def would appreciate some thoughts! 🙏
(I can also move the bug fixes to a separate PR if needed)
Description 📝
Changes 🔄
Preview 📷
How to test 🧪
Navigate to /vpcs and confirm routing behavior for
VPC Landing:
VPC Create
VPCDetails ******
Bug fixes:
Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅