strimzi: Fix crash when the Kafka cluster list is still loading - #917
Merged
illume merged 1 commit intoJul 21, 2026
Merged
Conversation
KafkaClass.useList().items is null while the query is loading (and on error), but KafkaTopicList and KafkaUserList mapped over it directly to build the namespace and cluster-name dropdowns. That threw "Cannot read properties of null (reading 'map')" and blanked the page whenever the lists were opened before the cluster list resolved, e.g. on a cluster with no topics or users. Normalise the cluster list to an array at the useList call site, and extract the dropdown derivations into null-tolerant helpers (clusterNamespaces, clusterNamesInNamespace) covered by unit tests. Also de-duplicate the shared KafkaClusterRef type into utils. Signed-off-by: Angelo Cesaro <cesaro.angelo@gmail.com>
cesaroangelo
force-pushed
the
strimzi-fix-null-list-crash
branch
from
July 20, 2026 22:05
6fa4f9e to
cf5ab6c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Strimzi plugin crash on the Kafka Topics and Kafka Users pages that occurred when the Kafka cluster list was still loading (useList().items === null) and the UI attempted to .map() over it.
Changes:
- Added null-tolerant helpers for deriving namespaces and cluster names from a possibly-null cluster list, with unit tests for the loading/null case.
- Updated Kafka Topic/User list components to normalize
useList().itemsto an array and reuse the shared helpers. - Centralized the shared
KafkaClusterReftype intosrc/utils/clusters.tsand updated component type imports.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| strimzi/src/utils/clusters.ts | Adds null-safe cluster list derivation helpers and shared KafkaClusterRef type. |
| strimzi/src/utils/clusters.test.ts | Unit tests covering null/loading and sorting/uniqueness behavior. |
| strimzi/src/components/TopicFormModal.tsx | Replaces local KafkaClusterRef type with shared utils type import. |
| strimzi/src/components/KafkaUserList.tsx | Normalizes useList results, uses shared helpers to avoid null crash. |
| strimzi/src/components/KafkaUserCreateFormModal.tsx | Replaces local KafkaClusterRef type with shared utils type import. |
| strimzi/src/components/KafkaTopicList.tsx | Normalizes useList results, uses shared helpers to avoid null crash. |
| strimzi/CHANGELOG.md | Documents the crash fix under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 24, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Opening the Kafka Topics or Kafka Users page throws
Cannot read properties of null (reading 'map')and blanks the page.It is reliably reproducible on a cluster that has no topics or users (the
lists render before the Kafka cluster list has resolved).
KubeObject.useList().itemsis typedArray<T> | nulland isnullwhilethe query is loading, but both list components mapped over it directly to
build the create-dialog namespace/cluster dropdowns.
Fix
useListcall site.(
clusterNamespaces,clusterNamesInNamespace) with unit tests coveringthe null/loading case, so the crash cannot silently regress.
KafkaClusterReftype intoutils.It's a small, self-contained change, and the null handling is covered by
unit tests.
tsc,eslint,prettierand the full test suite (71 tests)pass.
Note
This is a focused, standalone fix for the crash only. #850 also touches this
null crash, but bundles it with a v1-resources rework that has since landed
on
mainseparately, and appears stale.