-
Notifications
You must be signed in to change notification settings - Fork 21
Set and clear default pool from silos list on pool detail #3060
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
Merged
+220
−74
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
18e5c9f
set and clear default pool from silos list on pool detail
david-crespo 9ebfcf3
properties table on ip pool detail
david-crespo 6135759
say v4 unicast etc in confirm modals
david-crespo 00e9ae8
align modal copy
david-crespo 56b716a
better invalidation on silo ip pools tab
david-crespo 5ec9061
better error handling on confirm modal fetches
david-crespo 8c08fd6
use the same logic to improve the unlink modal copy
david-crespo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This whole inline fetch thing is weird, but it ensures we have the data before the modal is rendered, kind of like a loader. I considered an alternative where instead we render a component as the modal contents, which means it can call useQuery in order to render first and then fetch the uncached silo information as needed. The problem, as with all such render-then-fetch setups, is that you have visible pop-in of the result of the query. You can restructure the text so that the pop-in is less noticeable, but that makes it less readable, and you still have the pop-in. So I prefer the above even though it's a little weird. What it makes me really want is a way of doing something that works like a loader but for pseudo-navs like modal opens that are not route changes. There probably is a way to build that.
Diff of alternative approach
Uh oh!
There was an error while loading. Please reload this page.
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.
Had Mr. Claude figure out how a loader-like setup for modals would have to work, based on this PR and the above comment. It's quite helpful despite the Core Tensions and Key Insights. Spinner on the button that opens the modal is interesting, though we'd probably want to have it on a timer so it only shows up if the request takes longer than 300ms or something.
The core tension: route loaders give you fetch-before-render for free, but modals are orthogonal to routing. You either pay with imperative
.then()chains or with visible loading states.The best fit for console:
prefetchQuery+startTransition+useSuspenseQueryThis is the pattern that composes most naturally with the existing TanStack Query + React 19 stack:
queryClient.prefetchQuery(...)to warm the cache, then wraps the modal-open state change instartTransition.useSuspenseQuery(...), which suspends if data isn't cached yet.startTransitionprevents the Suspense fallback from flashing — React keeps the current UI visible while the modal's data resolves in the background.isPendingfromuseTransitioncan drive a subtle loading indicator on the trigger button.If data is already cached (the common case after the loader prefetched), the modal opens instantly. If not, the button shows a brief spinner, then the modal appears fully populated. No
.then()chains, no pop-in, and the modal component reads data declaratively.The key insight is that
startTransitionis the missing piece that makes Suspense work for modals — without it,use()/useSuspenseQueryalways shows the Suspense fallback initially, even for already-resolved promises (React issue #30701). With it, already-revealed content stays put while React renders the suspended tree offscreen.Other patterns considered
TanStack Router route masking — Modals as real routes with real loaders, URL masked to the parent path. Elegant concept but requires a router migration, and has known issues (preloading broken for masked links, unexpected scroll-to-top).
Next.js parallel/intercepting routes — Same idea (modal as route with loader), framework-specific. Not applicable.
React 19
use()with promise-as-prop — Start a promise in the click handler, store it in state, calluse(promise)in the modal. Works but redundant with TanStack Query's cache, and requiresstartTransitionanyway to avoid the fallback flash.React Router modal-as-route — Pass previous
locationas state, render the new route as a modal over the old one. The modal route gets a loader. Requires restructuring modals as routes, which is a big lift for the dozens of modals in console.Hover prefetching — Call
prefetchQueryononMouseEnter/onFocusof the trigger. Orthogonal to the above and can be layered on top for even faster perceived performance. TanStack Router does this withdefaultPreload="intent"on links.What this would look like for the
confirmActionpatternThe zustand-based
confirmActioncurrently takes a pre-builtmodalContent: ReactNode, which means data must be fully resolved before calling it. To support theuseSuspenseQuerypattern,confirmAction(or a new variant) would need to accept a component/render function instead of a static ReactNode, so the modal content can suspend. TheConfirmActionModalcomponent would wrap that content in a<Suspense>boundary, and the caller would useuseTransitionto open it. This is a meaningful but contained refactor of the confirm-action store.