Skip to content

upcoming: Enable Linode Interface query only when Delete Interface dialog is open and update Dialog title - #11881

Merged
coliu-akamai merged 4 commits into
linode:developfrom
coliu-akamai:interface-delete-dialog-query
Mar 20, 2025
Merged

coliu-akamai merged 4 commits into
linode:developfrom
coliu-akamai:interface-delete-dialog-query

Conversation

@coliu-akamai

Copy link
Copy Markdown
Contributor

Description 📝

  • small PR to only enable useLinodeInterfaceQuery in Delete Interface dialog if dialog is open

Changes 🔄

  • enable query when dialog is open (and when interface ID exists)
  • updated dialog title a bit

Preview 📷

Before After
image image
image no queries when delete dialog closed

How to test 🧪

Using devenv
Have a linode using new interfaces

Reproduction steps

  • On the develop branch, navigate to the Linode's network section
  • notice queries to get a linode interface erroring out

Verification

  • On this branch, confirm that there are no queries to linode/instances/{id}/interfaces/{interfaceId} when Delete Dialog isn't open
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

@coliu-akamai
coliu-akamai marked this pull request as ready for review March 18, 2025 21:42
@coliu-akamai
coliu-akamai requested a review from a team as a code owner March 18, 2025 21:42
@coliu-akamai
coliu-akamai requested review from bnussman-akamai, cliu-akamai and hkhalil-akamai and removed request for a team March 18, 2025 21:42

@bnussman-akamai bnussman-akamai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for fixing my mistake! This type of data-fetching bug is far too common 😖

@coliu-akamai coliu-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Mar 19, 2025
onClose={onClose}
open={open}
title={`Delete ${type} Interface?`}
title={`Delete ${type} Interface (ID: ${interfaceId})?`}

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.

This change is not mentioned in the PR description; was it meant to be included here?

@github-project-automation github-project-automation Bot moved this from Review to Approved in Cloud Manager Mar 19, 2025
@hkhalil-akamai hkhalil-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Mar 19, 2025
@hkhalil-akamai

hkhalil-akamai commented Mar 19, 2025 •

Copy link
Copy Markdown
Contributor

This type of data-fetching bug is far too common 😖

I've been thinking about this pattern which will make this type of bug easier to avoid:

export const useLinodeInterfaceQuery = (
  linodeId: number,
  interfaceId: number | undefined,
  enabled: boolean = true;
) => {
  return useQuery<LinodeInterface, APIError[]>({
    ...linodeQueries
      .linode(linodeId)
      ._ctx.interfaces._ctx.interface(interfaceId ?? -1),
     enabled && interfaceId !== undefined,
  });
};
const {
    ...
} = useLinodeInterfaceQuery(
    linodeId,
    interfaceId,
    open
  );

cc @bnussman-akamai

@bnussman-akamai

Copy link
Copy Markdown
Member

@hkhalil-akamai Yeah, that would work. It does feel a bit weird to pass an undefined interfaceId but it does the job

@coliu-akamai coliu-akamai changed the title upcoming: Enable Linode Interface query only when Delete Interface dialog is open upcoming: Enable Linode Interface query only when Delete Interface dialog is open and update Dialog title Mar 20, 2025
@coliu-akamai

Copy link
Copy Markdown
Contributor Author

switched to your suggestion @hkhalil-akamai - ty!

@linode-gh-bot

Copy link
Copy Markdown

Cloud Manager UI test results

🎉 539 passing tests on test run #4 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing539 Passing3 Skipped114m 3s

@coliu-akamai
coliu-akamai merged commit 1a0f0e4 into linode:develop Mar 20, 2025
@github-project-automation github-project-automation Bot moved this from Approved to Merged in Cloud Manager Mar 20, 2025
@coliu-akamai
coliu-akamai deleted the interface-delete-dialog-query branch March 20, 2025 15:27
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! Linode Interfaces

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants