Skip to content

[UX-1535] fix partition tab crash in topic view - #2665

Merged
r-vasquez merged 2 commits into
masterfrom
ux-1535-fix-partition-crash
Oct 5, 2026
Merged

r-vasquez merged 2 commits into
masterfrom
ux-1535-fix-partition-crash

Conversation

@r-vasquez

@r-vasquez r-vasquez commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Fixes UX-1535.

The topic page crashed with React error #310 when the Partitions tab mounted before its partitions loaded. TopicPartitions returned early before it called useDataTable, so the next render called one more hook.

This PR moves the columns and useDataTable above the early returns. The table uses an empty array until the partitions arrive.

It also adds tab-partitions.test.tsx as a reproducer. The test fails on the first commit and passes on the second.

Examples

Before: open a topic, click Partitions, go back, and open a different topic. The page shows "Rendered more hooks than during the previous render".
image

After: the same steps show the partitions table.
image

The Partitions tab crashes the topic page with React error #310 when
it mounts before the partitions request finishes. TopicPartitions
returns a skeleton before it calls useDataTable, so the render after
the data arrives calls one more hook than the first render.

The load-transition test mounts the tab with no partitions in the
store, then adds them. It fails with "Rendered more hooks than during
the previous render" until the hook order is fixed. The other tests
cover the no-permission case and the leaderless and under-replicated
badges.
Opening a topic on the Partitions tab before its partitions load
replaced the whole page with React error #310. TopicPartitions
returned a skeleton before it called useDataTable, so the render
after the data arrived called one more hook than the first render.
This happens on any topic when the tab is the remembered tab or is
opened from the #partitions hash.

The columns and useDataTable now run before the loading and
no-permission returns, with an empty array as data until the
partitions arrive. The returns only choose what to render.
@r-vasquez r-vasquez changed the title Ux 1535 fix partition crash [UX-1535] fix partition tab crash in topic view Oct 5, 2026
@r-vasquez
r-vasquez requested review from jvorcak and malinskibeniamin and removed request for malinskibeniamin October 5, 2026 21:18
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ Clean — no registry drift, off-token colours, or ad-hoc classes

App: frontend · Scope: diff vs origin/master · Files: 2

Count
⚠️ Outdated registry components 0
🛠 Locally-modified components 0
❓ Unknown to registry 0
🎨 Off-token palette colours 0
🔢 Ad-hoc utility classes 0

Generated by lookout audit-changes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The hook-ordering defect is correctly resolved and covered by focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes the Topic Partitions tab crash caused by inconsistent React hook ordering during asynchronous loading.

Changes:

  • Runs table hooks consistently before early returns.
  • Uses stable empty partition data while loading.
  • Adds regression tests for loading, permissions, and health indicators.
File Description
frontend/​src/​components/​pages/​topics/​tab-partitions.tsx Stabilizes hook ordering during partition loading.
frontend/​src/​components/​pages/​topics/​tab-partitions.test.tsx Adds regression and rendering coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@r-vasquez
r-vasquez merged commit b873ab0 into master Oct 5, 2026
18 checks passed
@r-vasquez
r-vasquez deleted the ux-1535-fix-partition-crash branch October 5, 2026 21:44
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.

3 participants