Skip to content
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

tech-story: [M3-8784] - Tanstack routing for Domains #11418

Merged
merged 15 commits into from
Dec 18, 2024

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Dec 13, 2024

Description 📝

Pretty simple PR (relative to the complex work that needed to be done for the /volume routing refactoring) to handle the Tanstack router migration for /domains

Nothing out of the ordinary for this one, just follows the now established routing patterns (soon to be documented)

Changes 🔄

-/domains routing setup

  • Lazy routes consolidation
  • useOrderV2 & usePaginationV2
  • Drawer routing

⚠️ note: domain details (adding records) drawers also should be routed, but since DomainRecords is a very large class component I decided to come back and do it once it's been broken down and converted to a functional component (M3-9015 & M3-9016)

Preview 📷

No visual difference to be expected (except for loading state in drawers)

How to test 🧪

Verification steps

  • Confirm navigation & routed drawers at /domains
    • Confirm pagination
    • Confirm sorting
  • Confirm navigation & drawers at /domains/{id}
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

  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@abailly-akamai abailly-akamai self-assigned this Dec 13, 2024
@abailly-akamai abailly-akamai marked this pull request as ready for review December 16, 2024 14:01
@abailly-akamai abailly-akamai requested a review from a team as a code owner December 16, 2024 14:01
@abailly-akamai abailly-akamai requested review from dwiley-akamai and mjac0bs and removed request for a team December 16, 2024 14:01
@@ -15,7 +15,7 @@ import { useCreateAccountBetaMutation } from 'src/queries/account/betas';
import { useBetaQuery } from 'src/queries/betas';

export const BetaSignup = () => {
const betaAgreement = `# Early Adopter Testing Program
const betaAgreement = `### Early Adopter Testing Program
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was caught by my route test once I made it more resilient. It caught two H1 headers on the page 🎉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, solid test!

// paramKey: 'volumeId',
// queryHook: useVolumeQuery,
// redirectToOnNotFound: '/volumes',
// });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left over code i had forgotten to cleanup

ended: DateTime.now().plus({ days: 5 }).toISO(),
enrolled: undefined,
started: DateTime.now().minus({ days: 30 }).toISO(),
}),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to PR - just bettering the mocking experience in /betas to have an active non-enrolled one featured in the list

http.get('*/domains/*/records', () => {
const records = domainRecordFactory.buildList(1);
return HttpResponse.json(makeResourcePage(records));
}),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were missing those, resulting in test failures with the route testing

useQuery<Domain, APIError[]>({
...domainQueries.domain(id),
enabled,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding an enabled toggle


export const domainDetailLazyRoute = createLazyRoute('/domains/$domainId')({
component: DomainDetail,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder we have decided to consolidate lazy routes in their own file (there is no particular need to have them within the component itself, which could be problematic for HMR)

};
}),
};
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition allows to bypass any loading state from react-query so we can always assert for a header

Copy link

github-actions bot commented Dec 16, 2024

Coverage Report:
Base Coverage: 86.97%
Current Coverage: 86.96%

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests & checks pass ✅
Navigation & routed drawers at /domains
Pagination ✅
Sorting ✅
Navigation & drawers at /domains/{id}

⚠️ note: domain details (adding records) drawers also should be routed [...]

Another thing to include in the next ticket is having the routing update when "Delete Domain" is clicked from the domain detail page (clicking "Delete" on the domain landing page updates the route)

@@ -127,9 +126,12 @@ export const CreateDomain = () => {
const isCreatingPrimaryDomain = values.type === 'master';
const isCreatingSecondaryDomain = values.type === 'slave';

const redirect = (id: '' | number, state?: Record<string, string>) => {
const redirect = (id: '' | number, _state?: Record<string, string>) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_state doesn't get used in the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out: I handled this more clearly in e784402

bit of a weird edge case but worth keeping parity over indeed 👍

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label Dec 17, 2024
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation to the different routes, ordering, and pagination generally worked as expected. ✅

I left a couple of observations.

@@ -15,7 +15,7 @@ import { useCreateAccountBetaMutation } from 'src/queries/account/betas';
import { useBetaQuery } from 'src/queries/betas';

export const BetaSignup = () => {
const betaAgreement = `# Early Adopter Testing Program
const betaAgreement = `### Early Adopter Testing Program
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, solid test!

@abailly-akamai
Copy link
Contributor Author

Solid review @mjac0bs - thanks for the fix and pointers.

Fixed the clone issue, created ticket for others!

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Dec 18, 2024
@abailly-akamai abailly-akamai requested a review from a team as a code owner December 18, 2024 16:31
@abailly-akamai abailly-akamai requested review from AzureLatte and removed request for a team December 18, 2024 16:31
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 470 passing tests on test run #12 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing470 Passing2 Skipped97m 37s

@abailly-akamai abailly-akamai merged commit 26adcac into linode:develop Dec 18, 2024
23 checks passed
Copy link

cypress bot commented Dec 18, 2024

Cloud Manager E2E    Run #6995

Run Properties:  status check passed Passed #6995  •  git commit 26adcaca8f: tech-story: [M3-8784] - Tanstack routing for Domains (#11418)
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #6995
Run duration 26m 58s
Commit git commit 26adcaca8f: tech-story: [M3-8784] - Tanstack routing for Domains (#11418)
Committer Alban Bailly
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 470
View all changes introduced in this branch ↗︎

dmcintyr-akamai pushed a commit to dmcintyr-akamai/manager that referenced this pull request Jan 9, 2025
* save progress

* SURGERY

* Implement basic routing

* Wrap up routing

* fix unit

* routes test update

* better handling in test

* fix smoke test

* Added changeset: Refactor Domains Feature Routing

* MSW fix

* edit changeset

* mock path consistency

* feedback @dwiley-akamai

* feedback @mjac0bs

* fix e2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Routing Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants