Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(ui): keep loading skeletons inside the page's padded container

Juan Denis2cfc1796e710
diff --git a/frontend/src/components/layouts/ResourceListPage.jsx b/frontend/src/components/layouts/ResourceListPage.jsx
index 11c1ec52..930bd5eb 100644
--- a/frontend/src/components/layouts/ResourceListPage.jsx
+++ b/frontend/src/components/layouts/ResourceListPage.jsx
@@ -89,15 +89,22 @@ export default function ResourceListPage({
};
if (loading) {
- // A resource list is always a table (or a card grid, when the page opted
- // into one), so the skeleton can predict the real shape rather than
- // falling back to the generic panel.
+ // Same wrapper as the loaded state below. A skeleton that renders
+ // outside the page's padded container occupies a different box than the
+ // content it predicts — it spans edge to edge, then everything jumps
+ // inward on arrival, which is precisely the flash a skeleton exists to
+ // prevent.
+ //
+ // The variant tracks the real shape: a resource list is a table, or a
+ // card grid when the page opted into one.
return (
- <EmptyState
- loading
- loadingVariant={renderCard && view === 'cards' ? 'cards' : 'table'}
- title={loadingTitle}
- />
+ <div className={cn('sk-tabgroup__inner', className)}>
+ <EmptyState
+ loading
+ loadingVariant={renderCard && view === 'cards' ? 'cards' : 'table'}
+ title={loadingTitle}
+ />
+ </div>
);
}
diff --git a/frontend/src/styles/components/_skeleton.scss b/frontend/src/styles/components/_skeleton.scss
index 2eec7a39..8360f8ce 100644
--- a/frontend/src/styles/components/_skeleton.scss
+++ b/frontend/src/styles/components/_skeleton.scss
@@ -132,6 +132,22 @@
// the 880px column the generic panel uses.
&:has(.sk-page-wrap) {
max-width: none;
+ // Several pages early-return their loading state, bypassing the padded
+ // container the loaded page renders into. Without this the skeleton
+ // spans edge to edge and then everything jumps inward on arrival —
+ // exactly the flash a skeleton exists to prevent. Page padding is
+ // reasserted here and dropped again below when a real container is
+ // already supplying it, so neither case doubles up.
+ padding: $space-6;
+ min-height: 0;
+ }
+}
+
+.sk-tabgroup__inner,
+.page-container,
+.wp-list {
+ > .empty-state--loading:has(.sk-page-wrap) {
+ padding: 0;
}
}