Skip to content

feat(ui): generic Skeleton component and skeleton loading states - #3523

Draft
RitvikSardana wants to merge 3 commits into
frappe:developfrom
RitvikSardana:skeleton-component
Draft

feat(ui): generic Skeleton component and skeleton loading states#3523
RitvikSardana wants to merge 3 commits into
frappe:developfrom
RitvikSardana:skeleton-component

Conversation

@RitvikSardana

Copy link
Copy Markdown
Member

Description

Adds a single generic <Skeleton /> component and uses it to replace spinners / blank screens with content-shaped loading states across the agent portal.

The component (desk/src/components/Skeleton/) has no per-screen configuration and two modes:

  • Bone mode — no slot: renders one gray pulse block, shaped via variant (line / circle / box) and width/height or utility classes. This is the primitive everything else composes.
  • Mask mode — slot + loading: renders the slotted component inert (inert, aria-hidden), walks the DOM and turns every leaf node (text, images, icons, buttons, inputs) into a gray pulse block at its real rendered size. When loading turns false the slot renders untouched. Meant for presentational components fed mock props.

The folder mirrors frappe-ui component conventions (Skeleton.vue, types.ts, index.ts), so it can be lifted upstream into frappe-ui as-is later.

Screens wired up (all bone composition, since these screens fetch their own data):

Screen Before After
All list views (Tickets, Contacts, Customers, Call Logs, KB — via ListViewBuilder) centered spinner on first load table skeleton: header + 12 rows with avatar and varied-width lines
Agent ticket page (TicketAgent.vue) small spinner full-layout skeleton: header bar, 3 conversation bubbles, sidebar field pairs
Customer / Contact detail pages blank screen while doc loads shared DetailPageSkeleton: avatar header, 4 stat cards, tabs, list lines

Skeletons show only on first load; reloads keep existing rows visible as before. Line widths vary deterministically ((row + column) % 4) so rows read organic without randomness.

How to test

  1. cd desk && yarn dev, open the agent portal.
  2. Throttle the network in devtools (Slow 3G helps make the states visible).
  3. Visit Tickets / Contacts / Customers / Knowledge Base — first load shows the table skeleton, then rows swap in place.
  4. Open a single ticket — layout skeleton with conversation bubbles and sidebar until the doc loads.
  5. Open a customer and a contact record — previously a blank screen, now the detail-page skeleton (square avatar for customer, circle for contact).
  6. Reload a list that already has data — no skeleton flash; existing rows stay visible while refreshing.

yarn build verified after each commit.

Related issue

No linked issue — raised from an internal improvement idea; happy to open one if needed.

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.

1 participant