You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
keep the single-spa update lifecycle responsive while an opted-in host waits for a dashboard refresh
acknowledge refresh completion through metadata.eventListener with the dashboard UID, refresh revision, and success status
deduplicate in-flight dashboard revisions and discard late completions after unmount
preserve the awaited update behavior for hosts that do not send refreshCompletionMode: "event"
Root cause
PR #252 awaited the dashboard's variable refresh from the single-spa update lifecycle. A slow variable query therefore left the parcel in UPDATING, triggered single-spa's three-second lifecycle warning, and held later dashboard/navigation updates behind the same lifecycle.
This change makes asynchronous completion an explicit host opt-in. In event mode, the update dispatches the refresh and returns promptly. Grafana later emits:
Only successful completion advances the stored revision. The event contains no error details, query text, or SQL.
Compatibility and rollout
Deploy this provider change before the matching host change. An old host omits refreshCompletionMode and retains the existing awaited lifecycle behavior. The new host sends refreshCompletionMode: "event" only for refresh requests and waits for the matching event acknowledgment.
This is an ordered provider-first compatibility rollout because deploying the host first against the old provider would provide no completion event.
Validation
yarn jest public/app/fn-app/create-mfe.test.tsx public/app/features/variables/state/onTimeRangeUpdated.test.ts --runInBand — 24 tests passed
Prettier check for the three changed files — passed
git diff --check — passed
yarn tsc --noEmit --pretty false — no diagnostics in changed files; the command remains nonzero with 122 diagnostics only in unchanged paths. These were not separately re-run on a clean base. The first unchanged error is public/app/features/variables/query/VariableQueryRunner.ts:202; the remainder are in the vendored public/app/plugins/panel/volkovlabs-table-panel tree (missing Volkov test packages and existing API/type drift).
Operational scope
no security, IAM, feature-flag, database, or configuration changes
normal CI, review, and merge queue apply
no admin merge requested
Summary by CodeRabbit
New Features
Dashboard refreshes can now report completion through success or failure events.
Added an optional event-based refresh completion mode.
Bug Fixes
Prevented duplicate refresh requests from being processed simultaneously.
Prevented outdated refresh results from overriding newer updates.
Refresh completions are safely ignored after the dashboard is unmounted.
Missing dashboard ownership now reports an unsuccessful result without causing an error.
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: c8024c66-1fff-4816-8dbf-14f975d6f604
📥 Commits
Reviewing files that changed from the base of the PR and between 769f2fe and 5fcfc5b.
📒 Files selected for processing (3)
public/app/fn-app/create-mfe.test.tsx
public/app/fn-app/create-mfe.ts
public/app/fn-app/types.ts
📝 Walkthrough
Walkthrough
The dashboard MFE now supports an opt-in refreshCompletionMode: 'event'. Event-mode updates return without awaiting refresh completion and emit dashboardRefreshCompleted events with the dashboard UID, revision, and success status. In-flight revisions are deduplicated, stale completions are ignored, and pending state is cleared on mount and unmount. Hosts without event mode retain awaited refresh behavior. Tests cover these paths.
Severity of issue fixed: Medium
✨ Finishing Touches🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch codex/grafana-refresh-ack
✨ Simplify code
Create PR with simplified code
Commit simplified code in branch codex/grafana-refresh-ack
A rabbit reads each line, The patch grows clear beneath the moon, Small changes hop in place, Tests guard the garden path, Reviews bloom before the dawn.
Comment @coderabbitai help to get the list of available commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
metadata.eventListenerwith the dashboard UID, refresh revision, and success statusrefreshCompletionMode: "event"Root cause
PR #252 awaited the dashboard's variable refresh from the single-spa
updatelifecycle. A slow variable query therefore left the parcel inUPDATING, triggered single-spa's three-second lifecycle warning, and held later dashboard/navigation updates behind the same lifecycle.This change makes asynchronous completion an explicit host opt-in. In event mode, the update dispatches the refresh and returns promptly. Grafana later emits:
Only successful completion advances the stored revision. The event contains no error details, query text, or SQL.
Compatibility and rollout
Deploy this provider change before the matching host change. An old host omits
refreshCompletionModeand retains the existing awaited lifecycle behavior. The new host sendsrefreshCompletionMode: "event"only for refresh requests and waits for the matching event acknowledgment.This is an ordered provider-first compatibility rollout because deploying the host first against the old provider would provide no completion event.
Validation
yarn jest public/app/fn-app/create-mfe.test.tsx public/app/features/variables/state/onTimeRangeUpdated.test.ts --runInBand— 24 tests passedyarn eslint public/app/fn-app/types.ts public/app/fn-app/create-mfe.ts public/app/fn-app/create-mfe.test.tsx --no-cache— passedgit diff --check— passedyarn tsc --noEmit --pretty false— no diagnostics in changed files; the command remains nonzero with 122 diagnostics only in unchanged paths. These were not separately re-run on a clean base. The first unchanged error ispublic/app/features/variables/query/VariableQueryRunner.ts:202; the remainder are in the vendoredpublic/app/plugins/panel/volkovlabs-table-paneltree (missing Volkov test packages and existing API/type drift).Operational scope
Summary by CodeRabbit
New Features
Bug Fixes