fix(dashboard): keep service rows during refetch (#666) - #684
Merged
Conversation
The services tab collapsed into its skeleton pulse-cards on every action and every tab switch. Two loading flags gated the whole tab and both flipped to true on every refetch: - refreshServices() set isLoading: true unconditionally, and its error path wiped the list to [] on transient failures. - ServicesTab OR-ed containersLoading (which flips on every fetchData call and every remount of the tab) straight into its skeleton gate. Fix: stale-while-revalidate semantics, matching what useEndpoint/ beginFetchState already do for project info. - refreshServices reports loading only when the list is empty and keeps the previous list when a refetch fails. - The tab renders its skeleton only when there is nothing to show; service rows render without container data (status falls back per service) while the containers read is in flight. Consumers of servicesData.isLoading (LogsSettings, OverviewTab, DomainSettings) inherit the calmer semantics: stale data stays on screen during revalidation instead of flashing placeholders. Fixes oblien#666
Review follow-up on oblien#684 — port the documented beginFetchState rule instead of sniffing loading off the data, and pair the tab's error gate so kept rows are actually visible. - New pure module src/context/services-fetch-state.ts: loading is loadedId !== id, not a property of the list. Same id is a REFRESH (keep rows, no skeleton); different id is a NAVIGATION (nothing of this project's to show — calling it loaded would render project A's services under project B). - refreshServices tracks servicesLoadedIdRef; both failure paths (success:false and throw) collapse into one symmetric fail() that keeps rows only for a same-id refresh. - ServicesTab: full-tab error card only when nothing is showable; failed refetch with rows keeps them and reports inline with retry. Fixes empty-project flash too: creating the first service no longer re-skeletons, since loadedId already matches. - Tests: 7 cases pinning refresh/navigation/first-load/failure — fails if anyone re-reads loading off the data again.
Member
|
thank you bro |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #666
Problem
The services tab collapsed into its skeleton pulse-cards on every action (create service, launch, drift fix) and every tab switch, then popped back when the response landed. Reported as "poor state update… annoying not smooth".
Root cause
Two loading flags gated the entire tab (
ServicesTab.tsx):refreshServices()setisLoading: trueunconditionally on every refetch — and its error path wiped the list to[], blanking the tab on transient failures.containersLoadingflipped totrueat the top of everyfetchData()call and on every remount of the tab (the tab is conditionally rendered peractiveTab, so switching back to Services re-skeletoned even with cached data).The codebase already solved this exact class of bug for project info —
begin-fetch-state.tsdocuments how "every invalidation unmounted the page's whole subtree" and fixed it with stale-while-revalidate. Services/containers never got that treatment.Fix
Port the same semantics:
refreshServicesreportsisLoadingonly when the list is empty (nothing on screen to keep), and keeps the previous list when a refetch fails.servicesData.isLoading || (containersLoading && services.length === 0). Rows render fine without container data — status falls back per service (ct?.status ?? …) — so container chips simply populate when the read lands (~20ms locally).Consumers of
servicesData.isLoading(LogsSettings,OverviewTab,DomainSettings) inherit the calmer semantics automatically: stale data stays visible during revalidation instead of flashing placeholders.Verification
tsc --noEmitclean