- more addition bugfixes

This commit is contained in:
2025-11-04 15:29:48 +00:00
parent 61894c0c42
commit c127ce8a8c
9 changed files with 87 additions and 62 deletions

View File

@@ -9,14 +9,17 @@ import { useEffect, useMemo } from "react";
type ChannelCardProps = {
touched: FormikTouched<BearerTypeFieldType & InitialValuesForm>;
isSubmitting: boolean;
isBof2ConstantsLoading: boolean;
isDispatcherLoading: boolean;
};
const ChannelCard = ({ touched, isSubmitting }: ChannelCardProps) => {
const ChannelCard = ({ touched, isSubmitting, isBof2ConstantsLoading, isDispatcherLoading }: ChannelCardProps) => {
const { values, setFieldValue } = useFormikContext<BearerTypeFieldType & InitialValuesForm>();
const { backOfficeQuery } = useCameraBackOfficeOutput(values?.format);
const isBackOfficeQueryLoading = backOfficeQuery?.isFetching;
const mapped = useMemo(() => {
const d = backOfficeQuery.data;
const d = backOfficeQuery?.data;
return {
backOfficeURL: d?.propBackofficeURL?.value ?? "",
username: d?.propUsername?.value ?? "",
@@ -27,7 +30,7 @@ const ChannelCard = ({ touched, isSubmitting }: ChannelCardProps) => {
}, [backOfficeQuery.data]);
useEffect(() => {
if (!backOfficeQuery.isSuccess) return;
if (!backOfficeQuery?.isSuccess) return;
for (const [key, value] of Object.entries(mapped)) {
setFieldValue(key, value);
}
@@ -36,12 +39,16 @@ const ChannelCard = ({ touched, isSubmitting }: ChannelCardProps) => {
return (
<Card className="p-4">
<CardHeader title={`Channel (${values?.format})`} />
<ChannelFields
touched={touched}
isSubmitting={isSubmitting}
backOfficeData={backOfficeQuery}
format={values?.format}
/>
{!isBof2ConstantsLoading && !isDispatcherLoading && !isBackOfficeQueryLoading ? (
<ChannelFields
touched={touched}
isSubmitting={isSubmitting}
backOfficeData={backOfficeQuery}
format={values?.format}
/>
) : (
<>Loading...</>
)}
</Card>
);
};