Skip to content

feat: some skeleton - #7936

Merged
wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@feat_skeleton
Nov 16, 2026
Merged

wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@feat_skeleton

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

feat: some skeleton

</el-skeleton>
</el-card>
</template>
</div>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The diff is generally reasonable, but there are a few potential issues and improvements:

  1. Skeleton may never show if resourceGroups is empty during loading

    • The skeleton is inside v-for="card in resourceGroups".
    • If resourceGroups starts as [] and is populated only after loading, no cards render, so no skeleton renders.
    • Since v-loading was 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.
  2. Ensure loading is reset in finally

    • handleNavigate now blocks navigation when loading.value is true.
    • If loadResources throws before resetting loading, 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
      }
    }
  3. Blocking navigation during all loading may be too aggressive

    • If loading is also used for background refreshes, users cannot navigate during a refresh.
    • Consider separating initialLoading from refreshing, 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-allowed or pointer-events-none, so the UI does not appear clickable but do nothing.
  4. The default el-skeleton does 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 #template with el-skeleton-item matching the card structure, and set a stable min-height.
  5. Check CSS that depends on direct children

    • Wrapping the card content in <el-skeleton> adds an extra wrapper element inside el-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.
  6. Minor accessibility / UX notes

    • The card still looks clickable during loading even though navigation is blocked.
    • Consider adding aria-busy to the loading container and aria-disabled to blocked cards.
    • The clickable el-card is not keyboard accessible by default. Consider using router-link/button or 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 }"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The change is reasonable, but there are a few issues worth addressing:

  1. Skeleton depends on metrics being populated

    • Both skeleton blocks are inside v-for="metric in metrics".
    • If metrics is 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 until metrics is populated.
    • Fix: either render fixed placeholder cards while loading && !metrics.length, keep a container-level loading indicator, or initialize metrics with placeholder entries.
  2. Chart skeleton and chart have mismatched spacing/height

    • The skeleton uses class="h-89 mt-4", while the chart uses class="-mt-6".
    • This can cause a visible layout jump when loading finishes.
    • Also verify h-89 exists 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.
  3. 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.

  4. 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-height matching the real content.
  5. 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.
  6. Chart is unmounted/remounted on every loading toggle

    • <MkLineChart v-else ... /> means the chart is destroyed while loading and recreated afterward.
    • If loading is 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.
  7. Minor accessibility/UX note

    • Consider adding aria-busy or a loading label if this is a user-facing dashboard and accessibility is important.

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.

@wangdan-fit2cloud
wangdan-fit2cloud merged commit 5ebcd94 into v3 Nov 16, 2026
3 of 4 checks passed
@wangdan-fit2cloud
wangdan-fit2cloud deleted the pr@v3@feat_skeleton branch November 16, 2026 08:14
initialLoading,
isApplicationGroupsLoaded,
loadApplicationGroups,
toggleGroup,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The diff looks mostly fine, but here are the irregularities and suggestions:

Potential issues

  1. initialLoading never resets / no retry handling.
    initialLoading.value = false is set in .finally(), which runs on both success and failure — that part is correct. However, if loadApplicationGroups() can be called again (e.g., a refresh or retry), initialLoading is left false. That's probably intended for a "first load only" flag; if it's meant as a general loading indicator, it should be set to true at the start of each call.

  2. completeGroupConversations() rejection is silent to the caller.
    Because .finally() is chained after .then(), the returned promise still rejects if either the page request or completeGroupConversations() 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.

  3. Error state not tracked.
    There's no error ref. If loading fails, initialLoading becomes false but consumers can't distinguish "loaded empty" from "failed." Consider adding loadError.

  4. Race conditions on repeated calls.
    If loadApplicationGroups() is invoked twice concurrently, the later .finally() may clear initialLoading before the first completes. A request-token / sequence guard would make this robust.

Optimization / style

  1. Indentation-only reformatting inflates the diff. Keeping the original .then(...) single-expression form and just appending .finally(() => { initialLoading.value = false }) would reduce review noise.

  2. Consider extracting the mapping logic (records -> expanded groups) into a helper; the arrow-chain is getting long.

  3. Naming: initialLoading is fine, but if it only tracks the very first fetch, a name like isInitialLoadDone/hasLoadedOnce (inverted) or a comment clarifies semantics.

Verdict: No functional bugs introduced; main concerns are the missing error state and concurrent-call guarding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants