Repository navigation
Dashboard: Fix duplicate rendering after inline custom dashboard saves - #270
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: This review used your included allowance. Your plan provides up to 100 included reviews per hour; 96 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (2)
🧰 Additional context used📓 Path-based instructions (2)Do not allow use of `eslint-disable`, `@ts-expect-error`, or `@ts-ignore` unless there's a clear, inline comment explaining why it's necessary.⚙️ CodeRabbit configuration file Files:
We are operating at scale.⚙️ CodeRabbit configuration file Files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughWhen an update assigns a nonempty portal container to a dashboard UID, the MFE registry removes other dashboards and their Grafana stores that use that container. UID-only updates do not remove other dashboards. Tests cover repeated draft and published UID transitions, same-UID updates, store retention, and teardown cleanup. Suggested reviewers: Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change prevents duplicate dashboards during container ownership transitions without disturbing unrelated dashboards. No actionable merge-blocking risk remains, subject to normal CI checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change contains duplicate rendering within a dashboard container and preserves independent containers. A pending refresh can still recreate state for a displaced dashboard, so ownership cleanup is not complete across asynchronous transitions. No new externally reachable security vulnerability was established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
A rabbit watched the dashboards trade, Comment |
Summary
Fix duplicate custom dashboard rendering after an inline panel resize/color edit is saved. A host portal now has exactly one dashboard owner: explicitly assigning its container to a new UID removes the previous dashboard and its Redux store atomically. Separate containers (including drill-down drawers) remain independent.
Root cause
The custom-dashboard host preserves its portal container while switching between published and draft dashboard UIDs. The MFE registry was keyed only by UID and retained both entries. Both portals rendered into the same existing DOM container, so the stale-container poller never removed either. Saving left the duplicate dashboard mounted, with the top instance's variable filter row empty.
Reproduced on local Adoption & Knowledge, without visiting a panel editor: drag the first panel's resize handle, wait for the draft, then click Save changes. Before this fix there were two dashboard roots / 18 panels instead of one / 9; after save the top filter submenu had height 0 while the other was 44px.
Validation
node node_modules/jest/bin/jest.js --runInBand --watch=false public/app/fn-app/fn-dashboard-page/fn-dashboard.test.tsx public/app/fn-app/create-mfe.test.tsx: 23 tests pass.git diff --checkpass.Scope / rollout
Client-side Grafana MFE registry only. No API, credential, BigQuery, RLS, persistence, schema or production changes. Explicit nonempty portal assignments transfer ownership; UID-only refresh/state patches do not evict another portal. Deploy through the normal authorized Grafana release path, then verify inline save and independent drill-down containers. Revert this commit if needed. This PR is not an authorization to deploy or merge.
Agent handoff
public/app/store/configureMfeStore.tsevicts a prior UID/store only when another UID explicitly claims the same nonempty container.public/app/fn-app/fn-dashboard-page/fn-dashboard.test.tsxcovers replacement, repeated transitions, retained stores and cleanup.coderabbit_micro_frontendbase96a06f3d20de1fe227ad53f9cd0143b1e7e2de39. Browser testing used the existing local stack plus this exact store patch.git status --shortin/Users/gurindersingh/Work/coderabbitai/grafana-dashboard-save.Summary by CodeRabbit