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
Our goal is to move as much data fetching inline to the components using hooks. But until then, we can use zustand and there were a couple of places missing useApiStoreHook after mobx migration. e.g. #2354
The PR continues the MobX → Zustand migration by replacing direct api.* property accesses with useApiStoreHook(...) subscriptions. Overall the approach is correct and consistent. One bug found, a few minor observations:
Bug: api.clusterHealth still accessed directly in tab-partitions.tsx
tab-partitions.tsx was partially migrated — topicPartitions was converted, but api.clusterHealth on lines 47 and 50 was left as a direct access. This means the leaderless/under-replicated partition badges won't re-render when cluster health data changes.
// tab-partitions.tsx:47-51 — still using api directlyconstleaderLessPartitions=(api.clusterHealth?.leaderlessPartitions??[]).find(...)constunderReplicatedPartitions=(api.clusterHealth?.underReplicatedPartitions??[]).find(...)
group-details.tsx — The consumerGroupAcl selector chains on group?.groupId where group itself comes from a prior hook call. This is technically fine (both hooks subscribe independently and will trigger re-renders correctly), but it means consumerGroupAcls.get('') is called when the group isn't loaded yet. Not harmful since it'll just return undefined, but worth noting.
topic-details.tsx — Removing useSyncExternalStore(useApiStore.subscribe, useApiStore.getState) in favour of targeted selectors is a clear improvement in precision.
delete-records-modal.tsx — The original code used api.topicPartitionErrors?.get(topicName) with optional chaining (?.get), which was defensive but unnecessary since the Map is always initialized. The new code correctly drops the ?.
Overall: clean, consistent migration. Fix the tab-partitions.tsxclusterHealth miss and this looks good to merge.
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.
Our goal is to move as much data fetching inline to the components using hooks. But until then, we can use zustand and there were a couple of places missing
useApiStoreHookafter mobx migration. e.g.#2354