mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 23:47:12 +00:00
feat: clean up tooltip elements and add dependencies (#8815)
This commit is contained in:
parent
39c2738ef9
commit
2acdd101d8
@ -62,7 +62,7 @@ const Uplot = forwardRef<ToggleGraphProps | undefined, UplotProps>(
|
||||
useEffect(() => {
|
||||
onCreateRef.current = onCreate;
|
||||
onDeleteRef.current = onDelete;
|
||||
});
|
||||
}, [onCreate, onDelete]);
|
||||
|
||||
const destroy = useCallback((chart: uPlot | null) => {
|
||||
if (chart) {
|
||||
@ -71,12 +71,25 @@ const Uplot = forwardRef<ToggleGraphProps | undefined, UplotProps>(
|
||||
chartRef.current = null;
|
||||
}
|
||||
|
||||
// remove chart tooltip on cleanup
|
||||
// Clean up tooltip overlay that might be detached
|
||||
const overlay = document.getElementById('overlay');
|
||||
|
||||
if (overlay) {
|
||||
// Remove all child elements from overlay
|
||||
while (overlay.firstChild) {
|
||||
overlay.removeChild(overlay.firstChild);
|
||||
}
|
||||
overlay.style.display = 'none';
|
||||
}
|
||||
|
||||
// Clean up any remaining tooltips that might be detached
|
||||
const tooltips = document.querySelectorAll(
|
||||
'.uplot-tooltip, .tooltip-container',
|
||||
);
|
||||
tooltips.forEach((tooltip) => {
|
||||
if (tooltip && tooltip.parentNode) {
|
||||
tooltip.parentNode.removeChild(tooltip);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
const create = useCallback(() => {
|
||||
|
||||
@ -9,7 +9,7 @@ function useInterval(
|
||||
|
||||
useEffect(() => {
|
||||
savedCallback.current = callback;
|
||||
});
|
||||
}, [callback]);
|
||||
|
||||
useEffect(() => {
|
||||
function tick(): void {
|
||||
|
||||
@ -16,6 +16,8 @@ const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
staleTime: 2 * 60 * 1000, // 2 minutes - data becomes stale after 2 minutes
|
||||
cacheTime: 5 * 60 * 1000, // 5 minutes - cache entries are garbage collected after 5 minutes
|
||||
retry(failureCount, error): boolean {
|
||||
if (
|
||||
// in case of manually throwing errors please make sure to send error.response.status
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user