You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example of how we could fetch basic data from one endpoint, begin showing it in the table, and fetch additional data separately, displaying spinners in place.
To try this out for yourself:
Checkout this branch locally and run the UI
Go to the zones list
Open the react query dev tools (that little palm tree thingy in the bottom left corner)
Find "listZonesWithSummary" in the query list
Click "Trigger loading" in the actions page on the right to simulate the loading of the second query
You should see spinners in the devices, controllers, and machines columns
Click "Restore loading" to simulate query success
You should now see the number of devices, controllers, and machines for each zone
The enabled-chaining is something we already do, and I agree it'd be good the jot it down as common practice. The main change with this approach seems to be field-based loading spinners added to each column. Could there be a way we could standardize this chaining into a singular hook that would return an intermediate partial success state?
The enabled-chaining is something we already do, and I agree it'd be good the jot it down as common practice. The main change with this approach seems to be field-based loading spinners added to each column. Could there be a way we could standardize this chaining into a singular hook that would return an intermediate partial success state?
I'm sure we could encapsulate it in a hook. My first thought is that hooks like these should live next to the view in which they're used in a hooks.ts file, since they're more of an abstraction from the API than the hooks in src/app/api/query.
I think it might also be worth looking at exposing useQuery options directly in each query hook. It's probably quite likely that we'll encounter cases where we want to set different query options (like enabled or refetchInterval differently, depending on where/how they are consumed. I tried giving this a go while writing this PR but was struggling with some type errors
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
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.
This is an example of how we could fetch basic data from one endpoint, begin showing it in the table, and fetch additional data separately, displaying spinners in place.
To try this out for yourself:
Loading state
Success state