Repository navigation
feat: some skeleton - #7936
feat: some skeleton#7936
Conversation
| </el-skeleton> | ||
| </el-card> | ||
| </template> | ||
| </div> |
There was a problem hiding this comment.
The diff is generally reasonable, but there are a few potential issues and improvements:
-
Skeleton may never show if
resourceGroupsis empty during loading- The skeleton is inside
v-for="card in resourceGroups". - If
resourceGroupsstarts as[]and is populated only after loading, no cards render, so no skeleton renders. - Since
v-loadingwas removed from the grid, the user may see a blank area while loading. - Fix: render placeholder skeleton cards when
loading && resourceGroups.length === 0, or keep a parent-level loading state.
- The skeleton is inside
-
Ensure
loadingis reset infinallyhandleNavigatenow blocks navigation whenloading.valueis true.- If
loadResourcesthrows before resettingloading, navigation will be blocked indefinitely and the skeleton will remain. - Use
try/finally:
async function loadResources() { loading.value = true try { // load data } finally { loading.value = false } }
-
Blocking navigation during all loading may be too aggressive
- If
loadingis also used for background refreshes, users cannot navigate during a refresh. - Consider separating
initialLoadingfromrefreshing, or only block navigation when the card data is not ready. - If you keep the guard, also make the card visually disabled during loading, e.g.
cursor-not-allowedorpointer-events-none, so the UI does not appear clickable but do nothing.
- If
-
The default
el-skeletondoes not match the card layout- The default skeleton renders generic text rows, not the label/total/avatar/details structure.
- This causes visual mismatch and possible layout shift when the real content appears.
- Use a custom
#templatewithel-skeleton-itemmatching the card structure, and set a stablemin-height.
-
Check CSS that depends on direct children
- Wrapping the card content in
<el-skeleton>adds an extra wrapper element insideel-card__body. - If existing CSS uses direct-child selectors such as
.el-card__body > .flex-between, it may break. - Verify the card body layout still works after the wrapper is added.
- Wrapping the card content in
-
Minor accessibility / UX notes
- The card still looks clickable during loading even though navigation is blocked.
- Consider adding
aria-busyto the loading container andaria-disabledto blocked cards. - The clickable
el-cardis not keyboard accessible by default. Consider usingrouter-link/buttonor adding keyboard handlers if this is important.
Overall, no syntax error is visible, but the main risk is the empty-resourceGroups case and ensuring loading is always reset.
| v-else | ||
| :value-formatter="metric.id === 'tokens' ? formatTokenNumber : numberFormat" | ||
| class="-mt-6" | ||
| :option="{ xData: days, yData: metric.series }" |
There was a problem hiding this comment.
The change is reasonable, but there are a few issues worth addressing:
-
Skeleton depends on
metricsbeing populated- Both skeleton blocks are inside
v-for="metric in metrics". - If
metricsis empty during the initial load, no skeletons will render at all. - Since you removed the parent
v-loading, the page may show no loading indicator untilmetricsis populated. - Fix: either render fixed placeholder cards while
loading && !metrics.length, keep a container-level loading indicator, or initializemetricswith placeholder entries.
- Both skeleton blocks are inside
-
Chart skeleton and chart have mismatched spacing/height
- The skeleton uses
class="h-89 mt-4", while the chart usesclass="-mt-6". - This can cause a visible layout jump when loading finishes.
- Also verify
h-89exists in your Tailwind config. It is not part of Tailwind’s default spacing scale. - Better: wrap the chart area in a fixed-height container and apply the same height/positioning to both skeleton and chart.
- The skeleton uses
-
Chart skeleton shape is not chart-like
<el-skeleton :rows="8" />renders several text-like skeleton rows, not a rectangular chart placeholder.- Prefer a single rectangular skeleton item:
<el-skeleton v-if="loading" animated> <template #template> <el-skeleton-item variant="rect" class="h-89 w-full" /> </template> </el-skeleton>
or use a custom skeleton matching the actual chart height.
-
Top-card skeleton may not match real card height
:rows="1"may be shorter than the actual card content, especially for the feedback card with two values.- This can cause card height/layout shift after loading.
- Consider a custom skeleton or a
min-heightmatching the real content.
-
Inconsistent loading presentation
- Top card titles are hidden by the skeleton.
- Bottom chart titles remain visible while only the chart area is skeletonized.
- If consistency matters, keep the title visible in both cases and skeletonize only the value/chart area.
-
Chart is unmounted/remounted on every loading toggle
<MkLineChart v-else ... />means the chart is destroyed while loading and recreated afterward.- If
loadingis also used for refreshes, this can cause unnecessary re-initialization and flicker. - Consider distinguishing initial loading from refreshing, or use
v-show/ an overlay if the chart can remain mounted with empty data.
-
Minor accessibility/UX note
- Consider adding
aria-busyor a loading label if this is a user-facing dashboard and accessibility is important.
- Consider adding
The v-if / v-else adjacency itself is valid. The main concerns are the empty-metrics loading case and the layout shift between skeleton and chart.
| initialLoading, | ||
| isApplicationGroupsLoaded, | ||
| loadApplicationGroups, | ||
| toggleGroup, |
There was a problem hiding this comment.
The diff looks mostly fine, but here are the irregularities and suggestions:
Potential issues
-
initialLoadingnever resets / no retry handling.
initialLoading.value = falseis set in.finally(), which runs on both success and failure — that part is correct. However, ifloadApplicationGroups()can be called again (e.g., a refresh or retry),initialLoadingis leftfalse. That's probably intended for a "first load only" flag; if it's meant as a general loading indicator, it should be set totrueat the start of each call. -
completeGroupConversations()rejection is silent to the caller.
Because.finally()is chained after.then(), the returned promise still rejects if either the page request orcompleteGroupConversations()fails. Callers must handle this. Pairing.finally()with an unhandled rejection could produce console errors if callers don't.catch(). Consider returning a handled promise or documenting the rejection contract. -
Error state not tracked.
There's noerrorref. If loading fails,initialLoadingbecomesfalsebut consumers can't distinguish "loaded empty" from "failed." Consider addingloadError. -
Race conditions on repeated calls.
IfloadApplicationGroups()is invoked twice concurrently, the later.finally()may clearinitialLoadingbefore the first completes. A request-token / sequence guard would make this robust.
Optimization / style
-
Indentation-only reformatting inflates the diff. Keeping the original
.then(...)single-expression form and just appending.finally(() => { initialLoading.value = false })would reduce review noise. -
Consider extracting the mapping logic (
records -> expanded groups) into a helper; the arrow-chain is getting long. -
Naming:
initialLoadingis fine, but if it only tracks the very first fetch, a name likeisInitialLoadDone/hasLoadedOnce(inverted) or a comment clarifies semantics.
Verdict: No functional bugs introduced; main concerns are the missing error state and concurrent-call guarding.
feat: some skeleton