Skip to content

refactor: [M3-7897] - Query Key Factory for Regions - #10301

Merged
bnussman-akamai merged 8 commits into
linode:developfrom
bnussman-akamai:M3-7897-update-region-queries-to-factory
Mar 21, 2024
Merged

bnussman-akamai merged 8 commits into
linode:developfrom
bnussman-akamai:M3-7897-update-region-queries-to-factory

Conversation

@bnussman-akamai

@bnussman-akamai bnussman-akamai commented Mar 20, 2024 •

Copy link
Copy Markdown
Member

Description 📝

Uses our new query key factory for region queries 🗺️

How to test 🧪

  • Check for any regressions with regions and region availability
    • For example, check the plans table on the Linode Create page

As an Author I have 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

@bnussman-akamai bnussman-akamai added the React Query Relating to the transition to use React Query label Mar 20, 2024
@bnussman-akamai bnussman-akamai self-assigned this Mar 20, 2024
@bnussman-akamai
bnussman-akamai requested a review from a team as a code owner March 20, 2024 16:17
@bnussman-akamai
bnussman-akamai requested review from dwiley-akamai and hkhalil-akamai and removed request for a team March 20, 2024 16:17
@github-actions

github-actions Bot commented Mar 20, 2024 •

Copy link
Copy Markdown

Coverage Report: ✅
Base Coverage: 81.64%
Current Coverage: 81.64%

@bnussman-akamai bnussman-akamai changed the title refactor: [M3-7897] - Use Query Key Factory for Region Queries refactor: [M3-7897] - Query Key Factory for Regions Mar 20, 2024

@hkhalil-akamai hkhalil-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feeling confident about these changes after some manual testing and all automated tests passing. Great work on continuing the query key factory work @bnussman-akamai!

Left some comments related to file structure/organization.

@@ -15,5 +16,6 @@ import { profileQueries } from './profile';
export const queries = mergeQueryKeys(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like we should have one consistent way to access the query keys. Most of the app directly imports each factory from its respective file, but it seems like this export has only one usage.

I prefer the first way, and if we stick to that, maybe we can delete this index file (and the need to keep it up to date) altogether.

Sorry, I realize I should've made this comment a few PRs ago.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I think I'm cool with deleting the index file and just doing the direct imports!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a convention on when to break out these requests into a separate requests.ts file? For most queries, it seems like the hooks and request helpers live together in one file. I'm fine either way but just curious.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Definitely could go either way but maintaining the split between the two files does feel a bit cleaner

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There's no convention, but I think having a dedicated requests.ts helps clean up the file that contains the hooks. I also ran into some circular dependency issues when doing the query key factory for account related endpoints, and I found that having a dedicated requests.ts made sense to help that too

@dwiley-akamai dwiley-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Region-related functionality throughout app ✅
Data in RQ DevTool ✅

enabled,
});

export const useRegionsAvailabilityQuery = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it'd be clearer to call this useRegionAvailabilityQuery (since it's for a single region) 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Definitely could go either way but maintaining the split between the two files does feel a bit cleaner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

React Query Relating to the transition to use React Query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants