Skip to content

fix(mfe): preserve pagination across unchanged host props - #259

Merged
harjotgill merged 1 commit into
coderabbit_micro_frontendfrom
codex/grafana-pagination-browser-history
Sep 18, 2026
Merged

harjotgill merged 1 commit into
coderabbit_micro_frontendfrom
codex/grafana-pagination-browser-history

Conversation

@harjotgill

@harjotgill harjotgill commented Sep 18, 2026 •

Copy link
Copy Markdown

Summary

Preserve child pagination across unchanged host rerenders.

After #258 was deployed and verified with uncached shared chunks, the internal Major drilldown emitted page1 A/B requests (page size10, index1, offset10), immediately followed by page0 A/B requests (index0, offset0). The UI returned to page1 with the same10 rows/11,557 total. A separate stale HTML cache initially masked #258; this PR does not change asset caching.

Cause and fix

RenderFNDashboard associated local history updates with the host query object by reference. Loading/result callbacks can recreate an unchanged stale host query object; the reference mismatch discarded local navigation and reset the real DashboardPage variable-refresh path.

Compare host query values semantically at the two local-state selection sites, and synchronize shared history with effective query values. Real host filter/scope changes still supersede local navigation and clear the superseded snapshot so returning to an earlier scope cannot resurrect it. Existing ownership filtering, changed-variable-only merging, authoritative uid, immutable location snapshots, and unsubscribe behavior remain unchanged. No new state framework, global refresh, SQL/authentication changes, or external I/O.

Validation

  • Before: adding an unchanged fresh host query object after page1 causes the actual FNDashboard → RenderFNDashboard → connected DashboardPage fixture to issue2 refreshes instead of1.
  • After: focused lifecycle integration uses actual createBrowserHistory, real portal/store/updateFnApp/DashboardPage behavior; covers stale host rerender, consecutive page1/page2, parent isolation, immutable inputs, no duplicate refresh on host echo, real filter/organization reset, and unsubscribe.
  • Existing query thunk and dashboard initialization remain fixture boundaries; no production SQL round trip is claimed.
  • Focused three-suite run, scoped ESLint, Prettier, and whitespace validation recorded before commit. Production image build/startup CI is required before merge. Full local typecheck/build are not rerun: fix(mfe): refresh drilldown pagination from history #258 documented unchanged baseline type errors and a missing local dependency; this patch changes no dependencies.

Rollout / rollback

Based on merged #258 (37934b809dc663c72a1f02e8baec27110bd268de). Normal review/CI first; no merge/deployment is authorized by this PR. After explicit release authorization, publish the Grafana base, verify derived regional digests/traffic and newly loaded changed shared chunks, then exercise child Next/Previous/page size, close/reopen and parent refresh overlap. Already-open/cached clients may retain older assets. Revert this commit to restore #258 behavior; no data migration.

Agent handoff

  • User intent / goal: fix the observed child pagination page1→page0 reset narrowly; preserve parent behavior and real host scope authority.
  • Current state: Fix cross-dashboard cancellation when closing drill-downs #257/fix(mfe): refresh drilldown pagination from history #258 published; uncached US live evidence proves the duplicate reset request. Recovery from this follow-up remains unverified.
  • Changed files: public/app/fn-app/fn-dashboard-page/render-fn-dashboard.tsx, public/app/features/dashboard/containers/DashboardPageLoading.test.tsx.
  • Decisions: semantic equality of the existing source snapshot, not a new navigation protocol or state owner.
  • Boundaries/guardrails: no added I/O, credentials, backend limits, permissions, release configuration, merge or deploy actions. Internal-only observed cohort; no claim of external customer impact.
  • Worktree/branch: /tmp/grafana-mfe-pagination-history, codex/grafana-pagination-browser-history.
  • Repository guidance: no tracked Grafana AGENTS.md or PR template; current mono template/handoff requirements were read and applicable context included here.
  • Risks/pending: production artifact CI and independent review; live recovery requires subsequent authorized deployment and correct assets.
  • References: fix(mfe): refresh drilldown pagination from history #258 ; https://github.com/coderabbitai/grafana/actions/runs/35290144359 .
  • First command: git status --short && git diff origin/coderabbit_micro_frontend...HEAD --stat.
  • First files: the two paths listed above.
  • First pending task: inspect the exact diff and normal production image CI; do not dispatch a release.
  • Test command: node node_modules/jest/bin/jest.js public/app/features/dashboard/containers/DashboardPageLoading.test.tsx public/app/fn-app/fn-dashboard-page/fn-dashboard.test.tsx public/app/fn-app/create-mfe.test.tsx --runInBand --watch=false --silent.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed dashboard navigation state handling when query parameters are equivalent but represented by different object references.
    • Prevented duplicate variable-change updates during host rerenders.
    • Improved preservation and restoration of child dashboard parameters, including organization scope, during pagination and query-parameter changes.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: bc5f93be-b4c2-4d29-978f-8332b1837da1

📥 Commits

Reviewing files that changed from the base of the PR and between 37934b8 and 9c93da8.

📒 Files selected for processing (2)
  • public/app/features/dashboard/containers/DashboardPageLoading.test.tsx
  • public/app/fn-app/fn-dashboard-page/render-fn-dashboard.tsx
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • coderabbitai/bitbucket (manual)

Included review availability: Your plan provides up to 100 included reviews per hour; 86 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Build
  • GitHub Check: build-and-test
🔇 Additional comments (2)
public/app/fn-app/fn-dashboard-page/render-fn-dashboard.tsx (1)

1-1: LGTM!

Also applies to: 38-46, 58-58

public/app/features/dashboard/containers/DashboardPageLoading.test.tsx (1)

16-20: LGTM!

Also applies to: 152-158, 199-199, 209-216


📝 Walkthrough

Walkthrough

The change makes RenderFNDashboard compare host query parameters by value instead of object reference. Unchanged host rerenders now preserve pending child navigation and avoid duplicate variable-change dispatches. Host filter and organization changes still replace local state. Tests now use browser-history-backed runtime behavior and verify pagination, scope synchronization, restoration, and rerender handling.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 9c93d

The dashboard now retains child pagination across equivalent host rerenders while host filter and organization changes still take precedence. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving pagination when host props remain unchanged.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR

A rabbit hops where page numbers stay,
No stale host query sends them astray.
Deep values guide the history trail,
While scopes update without fail.
The dashboard keeps its place with cheer,
And tests guard every change sincere.

Comment @coderabbitai help to get the list of available commands.

@harjotgill
harjotgill merged commit f8f1b35 into coderabbit_micro_frontend Sep 18, 2026
4 checks passed
@harjotgill
harjotgill deleted the codex/grafana-pagination-browser-history branch September 18, 2026 01:11
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.

1 participant