Skip to content

Commit e0619fe

Browse files
committed
fix(topics): isolate keepDirtyValues to RPCN form watch only
Address PR review feedback on #2420. The form-level `resetOptions: { keepDirtyValues: true }` (added so dirty fields survive the late `kafkaInfo` re-init) was leaking into the existing-topic-selected reset, where dirty fields should be overwritten by the selected topic's actual config. Also tighten the RF clamp comment in `create-topic-modal.tsx` to cover the all-brokers-offline case, not just the loading case. Refs UX-1208.
1 parent fffdafe commit e0619fe

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

frontend/src/components/pages/rp-connect/onboarding/add-topic-step.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ export const AddTopicStep = forwardRef<BaseStepRef<AddTopicFormData>, AddTopicSt
166166
}
167167
if (topicConfig && !topicConfig.error) {
168168
const allTopicValues = parseTopicConfigFromExisting(existingTopicSelected, topicConfig);
169-
form.reset(allTopicValues, { keepDefaultValues: false });
169+
// Override the form-level `keepDirtyValues: true` default — when a user
170+
// selects an existing topic, its config must fully replace any partial
171+
// input they've made.
172+
form.reset(allTopicValues, { keepDefaultValues: false, keepDirtyValues: false });
170173
} else {
171174
form.setValue('topicName', existingTopicSelected.topicName, {
172175
shouldDirty: false,

frontend/src/components/pages/topics/create-topic-modal.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ export const CreateTopicModal = ({ isOpen, onClose }: CreateTopicModalProps) =>
4646
});
4747
const { mutateAsync: createTopic, isPending: isCreateTopicPending } = useCreateTopicMutation();
4848
// Clamp RF to broker count so single-broker clusters (e.g. local-byoc) don't
49-
// fail CreateTopic with "not enough replicas". Fall back to the default if
50-
// the KafkaInfo query hasn't resolved yet.
49+
// fail CreateTopic with "not enough replicas". When `brokersOnline` is 0
50+
// (KafkaInfo still loading, or every broker is offline) keep the default —
51+
// a degraded cluster will reject CreateTopic regardless of what we send.
5152
const { data: kafkaInfo } = useGetKafkaInfoQuery();
5253
const brokersOnline = kafkaInfo?.brokersOnline ?? 0;
5354
const replicationFactor =

0 commit comments

Comments
 (0)