mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 22:19:01 +08:00
fix: disabling API call when the panel type is EMPTY (#3087)
This commit is contained in:
parent
f0f93c64d2
commit
ed200e50c8
@ -83,6 +83,11 @@ function GridCardGraph({
|
||||
|
||||
const updatedQuery = useStepInterval(widget?.query);
|
||||
|
||||
const isEmptyWidget = useMemo(
|
||||
() => widget?.id === 'empty' || isEmpty(widget),
|
||||
[widget],
|
||||
);
|
||||
|
||||
const queryResponse = useGetQueryRange(
|
||||
{
|
||||
selectedTime: widget?.timePreferance,
|
||||
@ -101,7 +106,7 @@ function GridCardGraph({
|
||||
variables,
|
||||
],
|
||||
keepPreviousData: true,
|
||||
enabled: isGraphVisible,
|
||||
enabled: isGraphVisible && !isEmptyWidget,
|
||||
refetchOnMount: false,
|
||||
onError: (error) => {
|
||||
setErrorMessage(error.message);
|
||||
@ -131,8 +136,6 @@ function GridCardGraph({
|
||||
);
|
||||
|
||||
const onDeleteHandler = useCallback(() => {
|
||||
const isEmptyWidget = widget?.id === 'empty' || isEmpty(widget);
|
||||
|
||||
const widgetId = isEmptyWidget ? layout[0].i : widget?.id;
|
||||
|
||||
featureResponse
|
||||
@ -147,7 +150,8 @@ function GridCardGraph({
|
||||
});
|
||||
});
|
||||
}, [
|
||||
widget,
|
||||
isEmptyWidget,
|
||||
widget?.id,
|
||||
layout,
|
||||
featureResponse,
|
||||
deleteWidget,
|
||||
|
Loading…
x
Reference in New Issue
Block a user