Skip to content

fix(ui): show loader on User Metadata tab while decoding - #4209

Open
ShilpThapak wants to merge 2 commits into
temporalio:mainfrom
ShilpThapak:fix/user-metadata-loader
Open

ShilpThapak wants to merge 2 commits into
temporalio:mainfrom
ShilpThapak:fix/user-metadata-loader

Conversation

@ShilpThapak

@ShilpThapak ShilpThapak commented Nov 23, 2026 •

Copy link
Copy Markdown

Fixes #4208.

Problem

Opening Workflows > <workflow> > User Metadata shows no loading indicator while its data is being fetched:

  1. Summary/Details decode blocked first render. workflow-run-layout.svelte awaited decodeWorkflowUserMetadata() before setting $workflowRun.workflow, so a slow codec server blocked the entire workflow page behind the generic skeleton. The store also initialised userMetadata as { summary: '', details: '' }, indistinguishable from "loaded empty".
  2. Current Details query had no loader at all. The __temporal_workflow_metadata query (executed against the workflow worker, can take seconds — e.g. /api/v1/namespaces/<ns>/workflows/<id>/query/__temporal_workflow_metadata) rendered an empty Markdown while pending: workflow-current-details.svelte owned a loading flag but never wired it into the markup.

Impact

On Temporal Cloud this path is slow, and without a loader it is impossible to tell "still loading" from "no metadata available" — so you keep waiting instead of moving on. Spinner means wait; the empty state means there is genuinely nothing there.

Fix

  • src/lib/stores/workflow-run.ts: add userMetadataLoading: boolean to WorkflowRunWithWorkers (mirrors existing workersLoaded), true in initialWorkflowRun.
  • src/lib/layouts/workflow-run-layout.svelte: set workflow immediately and decode user metadata in the background (void decode…), merging results and clearing the flag in finally, guarded by a namespace/workflow/run identity check so a stale decode can't overwrite a newly navigated-to run.
  • src/lib/pages/workflow-user-metadata.svelte: render <Loading /> while userMetadataLoading, matching the {#await …} <Loading /> pattern used by batch-operations.svelte.
  • src/lib/components/workflow/metadata/workflow-current-details.svelte: render <Loading /> while loading && !currentDetails — loader only while data is actually loading; an R-refresh keeps showing stale content instead of flashing a spinner.

Out of scope (possible follow-up): standalone-activity-metadata.svelte and standalone-nexus-operation-metadata.svelte use {#await decodeMetadata …} with no pending slot and show blank while decoding. The layout also fires getWorkflowMetadata in addition to the component's own fetch (double query) — left as is.

Before / After

Recorded against the integration mock workflow with sample Current Details data and a simulated 1.5s query delay.

Before — page renders, Summary/Details show, but the Current Details panel sits blank until the query resolves:

before-current-details-loading.mp4

After — the Current Details panel shows the loader until the query resolves, then renders the sample content:

after-current-details-loading.mp4

Verification

  • pnpm check: 0 errors
  • pnpm eslint on touched files: 0 errors
  • pnpm vitest run src/lib/stores/favicon.test.ts src/lib/utilities/decode-payload.test.ts: 32 passed
  • PW_MODE=integration pnpm playwright test tests/integration/workflow-metadata.spec.ts: 8 passed (incl. new Shows loader on Current Details while metadata query is pending, which fails on the pre-fix code)

This PR was generated with the help of AI.

@ShilpThapak
ShilpThapak requested a review from a team as a code owner November 23, 2026 08:15
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Temporal Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Nov 23, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Add userMetadataLoading flag to workflow-run store (mirroring
workersLoaded), decode user metadata without blocking first render,
and render <Loading /> on the User Metadata page until decoding
finishes. Guards the async write with a run-identity check so a
stale decode cannot overwrite a newly navigated-to run.

Fixes temporalio#4208
@ShilpThapak
ShilpThapak force-pushed the fix/user-metadata-loader branch from ddd325b to cdffb6f Compare November 23, 2026 08:23
The __temporal_workflow_metadata query can take seconds (it executes
against the workflow worker), but workflow-current-details rendered an
empty Markdown in the meantime — the local loading flag was never
wired into the markup. Render <Loading /> while loading with nothing
to show yet; keep showing stale content on R-refresh instead of
flashing a spinner.

Add an integration test with a delayed query mock carrying sample
currentDetails: asserts the loader appears while pending and the
sampled content renders after.
@ShilpThapak

ShilpThapak commented Nov 23, 2026 •

Copy link
Copy Markdown
Author

Reviewers, I have limited understand of this codebase.
Raised this PR to fix the issue with AI.
Thanks.

This branch has not been deployed

No deployments
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