mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 01:25:53 +08:00
fix: updated the form value on mount (#4076)
* fix: updated the form value on mount * fix: isLoading is replaced isFetching
This commit is contained in:
parent
780a863943
commit
16839eb7d3
@ -22,7 +22,7 @@ import {
|
|||||||
import FormAlertChannels from 'container/FormAlertChannels';
|
import FormAlertChannels from 'container/FormAlertChannels';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
|
||||||
@ -57,6 +57,12 @@ function EditAlertChannels({
|
|||||||
setType(value as ChannelType);
|
setType(value as ChannelType);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
formInstance.setFieldsValue({
|
||||||
|
...initialValue,
|
||||||
|
});
|
||||||
|
}, [formInstance, initialValue]);
|
||||||
|
|
||||||
const prepareSlackRequest = useCallback(
|
const prepareSlackRequest = useCallback(
|
||||||
() => ({
|
() => ({
|
||||||
api_url: selectedConfig?.api_url || '',
|
api_url: selectedConfig?.api_url || '',
|
||||||
|
@ -18,7 +18,7 @@ function ChannelsEdit(): JSX.Element {
|
|||||||
const { id } = useParams<Params>();
|
const { id } = useParams<Params>();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { isLoading, isError, data } = useQuery(['getChannel', id], {
|
const { isFetching, isError, data } = useQuery(['getChannel', id], {
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
get({
|
get({
|
||||||
id,
|
id,
|
||||||
@ -29,7 +29,7 @@ function ChannelsEdit(): JSX.Element {
|
|||||||
return <Typography>{data?.error || t('something_went_wrong')}</Typography>;
|
return <Typography>{data?.error || t('something_went_wrong')}</Typography>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoading || !data?.payload) {
|
if (isFetching || !data?.payload) {
|
||||||
return <Spinner tip="Loading Channels..." />;
|
return <Spinner tip="Loading Channels..." />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user