Files
Alex JbancaandAnastasiya bd3fccc449 perf: load the chat and community sections asynchronously with skeletons (#21917)
* perf: load chat and community sections asynchronously with skeletons

The section loaders own the chrome (StatusSectionLayout) and show the
matching skeleton — with the real, functional header — while the actual
section incubates behind an asynchronous Loader; the section's panels
are proxied back into the loader-owned chrome once ready (full-page
community views hide it). The communities portal loader turns
asynchronous too. The pre-ready startup overlay recomposes from the
skeleton panels, replacing the ChatLayoutLoading placeholder view (whose
AppMain reference had been left dangling).

* fixup! perf: load chat and community sections asynchronously with skeletons

Each skeleton slot was gated on the whole section loader reaching Ready, so
the header, chat list, message column and member list all swapped in at once,
paced by the slowest panel. ChatView now publishes per-panel readiness and
ChatLayout forwards it, letting each slot retire on its own. `root.item` is
null until the section itself loads, so the old whole-loader behaviour remains
the floor.

The right panel is not deferred at this point in the stack, so its flag is
constant; it becomes meaningful once the members panel moves behind a loader.

Also drops `signal ready()` from both section loaders: `mainReady` is fed to
AppMain by AppMainLoader and nothing has ever connected to `ready`, so the
signal and the comment claiming AppMain owns the spinner toggle are both dead.

* fixup! perf: load chat and community sections asynchronously with skeletons

The startup overlay predates the loader-owned chrome. ChatLoader and
CommunityChatLoader declare their skeleton panels as plain children, which Qt
instantiates and paints even while the loader is inactive, so for the chat
section the overlay now covers an already-correct skeleton with a duplicate of
itself.

Scoped to the two cases where nothing else paints yet: the communities portal
(CommunitiesPortalLoader is gated on mainReady and owns no skeleton), and a
community section during the window where activeSectionType is already
`community` but the repeater has not produced any delegate — the same window
the currentIndex fallback below already accounts for.

* fixup! perf: load chat and community sections asynchronously with skeletons

Release the chrome skeletons instead of hiding them: permanent
visible:-gated skeletons re-evaluate their tile geometry bindings on
every resize for the lifetime of the section (same class as the
ChatContentView messages skeleton, caught in a resize profile). Each
skeleton now lives behind a Loader gated on its slot's readiness.

* fixup! perf: load chat and community sections asynchronously with skeletons

The slots fell through to the real panel as soon as `root.item` existed.
ChatView's panels are non-null Loader objects from the moment the section
loads, so `?? skeleton` never saw the readiness flags: the LayoutItemProxy
retargeted to an empty Loader, released the skeleton with
setParentItem(null)/setVisible(false), and the slot painted nothing until
the panel incubated. Gate each slot on its own flag instead.

The skeletons collapse to bare Loaders keyed on `!ready`, dropping the
wrapper Item whose `visible` the proxy also writes.

tst_SectionLoaderChrome drives both loaders with a stub section whose
flags are writable, so the contract is pinned as a binding rather than as
a race against incubation.

* fixup! perf: load chat and community sections asynchronously with skeletons

The startup overlay's only remaining case was a community section with no
repeater delegate yet, and it painted the chat-list skeleton there — wrong
shape, replaced a frame later by CommunityChannelsSkeleton. Keep the
overlay for the communities portal, which has nothing else painting, and
let a missing community delegate fall back to the currentIndex loader,
which already shows the right shape.

* fixup! perf: load chat and community sections asynchronously with skeletons

* chore(@e2e): fix tests according to the changes

* fixup! perf: load chat and community sections asynchronously with skeletons

* fixup! perf: load chat and community sections asynchronously with skeletons

---------

Co-authored-by: Anastasiya <anastasija.ig@gmail.com>
2026-08-22 08:13:51 +03:00
..