Skip to content

feat(designsystem): page load line owns its motion and its end - #5172

Merged
stamp-build[bot] merged 4 commits into
mainfrom
agent/lagoon/page-loading-line-motion
Nov 20, 2026
Merged

stamp-build[bot] merged 4 commits into
mainfrom
agent/lagoon/page-loading-line-motion

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Lagoon from raft opened this pull request through Stamp
View in Stamp →


What

The page load line on in-app web pages (RaftPageLoadingBar, added in #5167) gets the approved motion. Unchanged: 2dp, edge to edge, square ends, flush under the top bar, info colour.

  • No progress yet: a still line at 8% width. The back-and-forth sweep is gone from this component (RaftProgressBar keeps its own; raftProgressBarSweep is now private to its file).
  • Progress: follows the page, forward only, each change over 200ms ease-out. A new load starts again from the beginning.
  • Fast pages: the line first shows 200ms into a load; a load that ends sooner draws nothing.
  • Finish: runs to 100%, then fades out over 200ms. Failure: gone at once.
  • Reduced motion (rememberRaftReducedMotion()): the width jumps to each value, and a finished line goes at once.

API

The component now owns its life, so callers keep it composed and report the load:

sealed interface RaftPageLoadState { Idle; Loading(progress: Float? = null, load: Int = 0); Finished; Failed }

RaftPageLoadingBar(state, modifier, contentDescription,
    reducedMotion = rememberRaftReducedMotion(),
    appearDelayMillis = RaftPageLoadingBarAppearDelayMillis)

The life of the line is plain data (RaftPageLoadingBarLine: Hidden / Waiting / Shown / Leaving, onState, onAppearDelayPassed, onLeft), so the rules are unit-tested without a clock; the composable only runs the 200ms timer and the two animations. Durations and fractions are named constants in the component (raft-ui has no matching tokens yet).

Decisions worth a look:

  • The 95% cap stays, moved into the component (RaftPageLoadingBarLoadingMaxFraction). Engines report 100% some time before the load ends; keeping the full line for Finished means a full line always means done and the run to the end is always visible. The app-side cap is removed.
  • A new load is an explicit signal from the host, never inferred from progress: Loading.load names the load, and the line starts again when it changes. The web views count main-frame loads started (RaftWebViewNavigationState.loadGeneration: Android onPageStarted, iOS didStartProvisionalNavigation, desktop the not-loading to loading edge), so the rule is the same on every platform. (iOS reads WebKit's estimated progress when a load starts and need not pass through 0, so inferring it from progress could hold the line at the last load's width there.) A line that is already up stays up and snaps back; it never animates backwards.
  • 8% is also the floor: progress below 8% keeps the line at 8%.
  • The line is in the tree (test tag, progress-bar semantics, content description) only while it is drawn.

Call sites

All go through raftWebPageLoadState(isLoading, progress, failed, loadGeneration):

navigation state line
the page shows its error state Failed
loading Loading(progress, load = loadGeneration), no progress while the engine reports 0
not loading, progress 100 Finished (Android onPageFinished and iOS didFinish are the only places that set 100 with loading off)
not loading, progress under 100 Idle: stopped by the user, or failed with the failure callback still to come (the engines report "not loading" first). These can't be told apart, so the line goes at once
  • InAppBrowserPage: failed = loadError != null.
  • SettingsWebViewContent: from settingsWebViewPresentation (Error covers load errors, stalls and a crashed renderer).
  • SettingsWebViewLoadingPlaceholder (session or URL not known yet): Loading() only.

One line across the placeholder → page swap

The line belongs to the container that swaps the placeholder for the page, not to either of them: RaftWebPageLoadLineHost is a Box that draws the one RaftPageLoadingBar over its content, and the placeholder and SettingsWebViewContent only report their state to it (RaftWebPageLoadLine; the piece that entered last speaks). The line stays composed across the swap and goes on from where it was; no timer is involved.

Hosts: SettingsWebViewPageScaffold's body (every Settings web page and Release notes, through both swaps: body-ready and session-known), StandaloneSettingsWebViewContent (when used without the scaffold) and the release notes on AppUpdatePage. A nested host defers to the outer one. SettingsWebViewContent used with no host (server setup admission, which has a plain cover and no placeholder line) draws its own line as before.

Tests

  • RaftPageLoadingBarLineTest (commonTest): rest width, cap, forward-only, a new load named by the host, "no progress" not read as a new load, fast-load no-show, finish / fail / stop, reduced motion, a load after an ended one.
  • RaftPageLoadingBarUiTest (desktopTest, test clock): the 200ms delay, no line for a fast load, run to the end and fade, at once on failure, reduced motion.
  • SettingsStandaloneWebViewHostTest: raftWebPageLoadState mapping (load generation included) and the host's combined state.
  • SettingsWebViewStallRetryUiTest (Robolectric, test clock): lets the delay and the exit pass; new handoff test: placeholder for 500ms, then the real SettingsWebViewContent loading; the line is asserted present on every frame from the appear delay to 1.3s, then carries the page's progress.
  • Goldens page_loading_bar_{light,dark}.png re-recorded in CI (record_screenshots=true): rows are now no progress (8%), 42%, and a page reporting 100% (held at 95%).

Docs

README row and the "Differences from raft-ui" note (a raft-design PageLoadingLine is being added upstream to match); the 1.28.0 changeset is replaced by one describing the final behaviour (web-page-loading-line.md).

Not tested

Nothing here ran on a device. The animation curve, the fade and the reduced-motion setting are only covered through the test clock and the pure model. The web views' loadGeneration increments have no test of their own on iOS and desktop (Android's is driven through Robolectric's WebView in the handoff test).

🤖 Generated with Claude Code

Lagoon and others added 4 commits November 20, 2026 16:29
RaftPageLoadingBar now takes the load as a state (RaftPageLoadState: Idle,
Loading(progress?), Finished, Failed) and stays composed, so it can play
the approved motion itself instead of being removed by its callers:

- it first shows 200ms into a load; a faster page draws no line
- no progress yet: a still line at 8% (the sweep is gone from this
  component; RaftProgressBar keeps its own, now private to its file)
- progress: forward only, each change over 200ms ease-out, up to 95%
  while the load still runs; "no progress" after progress is a new load
  and starts again from the beginning
- Finished: runs to the end, then fades out over 200ms; Failed and Idle
  drop it at once
- reduced motion: the width jumps and a finished line goes at once

The life of the line is plain data (RaftPageLoadingBarLine), tested in
commonTest; the delay, exit and failure are tested on the test clock in
RaftPageLoadingBarUiTest.

The three call sites report the web view's navigation state through
raftWebPageLoadState: failed -> Failed; loading -> Loading; not loading at
100 -> Finished; not loading short of 100 (stopped, or failed before the
failure callback) -> Idle, because those cannot be told apart.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Recorded by CI (test.yml record_screenshots=true, run 44774097305): the
rows are now no progress (the still 8% line), 42%, and a page reporting
100% while it still loads (held at 95%).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The line showed, went and came back about 200ms later when a Settings web
page's placeholder (session not known yet) gave way to the page, because
each drew its own. The line now belongs to the container that swaps them:
RaftWebPageLoadLineHost draws the one RaftPageLoadingBar over its content,
and the placeholder and SettingsWebViewContent report their state to it
(RaftWebPageLoadLine). It stays composed across the swap and goes on from
where it was. Hosts: the Settings web page scaffold's body (Settings pages
and Release notes), StandaloneSettingsWebViewContent, and the release
notes on the App update page.

A new load is now an explicit signal instead of "progress went back to
none": RaftPageLoadState.Loading carries the load's name, and the web
views count main-frame loads started (RaftWebViewNavigationState
.loadGeneration: Android onPageStarted, iOS didStartProvisionalNavigation,
desktop the loading edge). iOS reads WebKit's estimated progress at the
start of a load and need not pass through 0, so the old inference could
hold the line at the last load's width there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@stamp-build stamp-build Bot added the build-alpha Build a cloud-hosted .alpha validation APK label Nov 20, 2026
@stamp-build
stamp-build Bot merged commit 87b8b33 into main Nov 20, 2026
18 checks passed
@stamp-build

stamp-build Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

New failure in post-merge full tests: workflow App link diagnose on branch main after PR 5172 merged.

Newly failing:

  • Report (possibly flaky)

It could be any of PR 5160, PR 5162, PR 5164, PR 5165, PR 5167, PR 5168, PR 5169, PR 5170 and 14 more.

Please fix. See logs: stamp run view 44849680002 --repo botiverse/mobile --log-failed

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

Labels

build-alpha Build a cloud-hosted .alpha validation APK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants