Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: added fix for panel sync mode in non-view panels (#11187)

Abhi kumar18d5e92ae2a6
diff --git a/frontend/src/hooks/dashboard/__test__/useDashboardCursorSyncMode.test.ts b/frontend/src/hooks/dashboard/__test__/useDashboardCursorSyncMode.test.ts
index acbbc29178..ccbd0af637 100644
--- a/frontend/src/hooks/dashboard/__test__/useDashboardCursorSyncMode.test.ts
+++ b/frontend/src/hooks/dashboard/__test__/useDashboardCursorSyncMode.test.ts
@@ -118,7 +118,7 @@ describe('useDashboardCursorSyncMode', () => {
describe.each([[PanelMode.DASHBOARD_EDIT], [PanelMode.STANDALONE_VIEW]])(
'in %s mode (cursor sync disabled)',
(panelMode) => {
- it('returns the Crosshair default and ignores any stored value', () => {
+ it('returns None and ignores any stored value', () => {
useDashboardPreferencesStore.setState({
preferences: { 'dash-1': { cursorSyncMode: DashboardCursorSync.Tooltip } },
});
@@ -127,7 +127,7 @@ describe('useDashboardCursorSyncMode', () => {
useDashboardCursorSyncMode('dash-1', panelMode),
);
- expect(result.current[0]).toBe(DashboardCursorSync.Crosshair);
+ expect(result.current[0]).toBe(DashboardCursorSync.None);
});
it('treats the setter as a no-op and does not write to the store', () => {
@@ -136,14 +136,14 @@ describe('useDashboardCursorSyncMode', () => {
);
act(() => {
- result.current[1](DashboardCursorSync.None);
+ result.current[1](DashboardCursorSync.Tooltip);
});
expect(useDashboardPreferencesStore.getState().preferences).toStrictEqual(
{},
);
expect(localStorage.getItem(STORAGE_KEY)).toBeNull();
- expect(result.current[0]).toBe(DashboardCursorSync.Crosshair);
+ expect(result.current[0]).toBe(DashboardCursorSync.None);
});
},
);
diff --git a/frontend/src/hooks/dashboard/useDashboardCursorSyncMode.ts b/frontend/src/hooks/dashboard/useDashboardCursorSyncMode.ts
index 9cbb664a84..527deda270 100644
--- a/frontend/src/hooks/dashboard/useDashboardCursorSyncMode.ts
+++ b/frontend/src/hooks/dashboard/useDashboardCursorSyncMode.ts
@@ -3,8 +3,6 @@ import { DashboardCursorSync } from 'lib/uPlotV2/plugins/TooltipPlugin/types';
import { useDashboardPreference } from './useDashboardPreference';
import { PanelMode } from 'container/DashboardContainer/visualization/panels/types';
-const DEFAULT_CURSOR_SYNC_MODE = DashboardCursorSync.Crosshair;
-
const NOOP = (): void => {};
export function useDashboardCursorSyncMode(
@@ -14,14 +12,14 @@ export function useDashboardCursorSyncMode(
const [value, setValue] = useDashboardPreference(
dashboardId,
'cursorSyncMode',
- DEFAULT_CURSOR_SYNC_MODE,
+ DashboardCursorSync.Crosshair,
);
// Chart panels in edit / standalone modes don't participate in cross-panel
// sync, so surface the default with a no-op setter for them. Callers without
// a panelMode (e.g. dashboard settings) read/write the preference normally.
if (panelMode && panelMode !== PanelMode.DASHBOARD_VIEW) {
- return [DEFAULT_CURSOR_SYNC_MODE, NOOP];
+ return [DashboardCursorSync.None, NOOP];
}
return [value, setValue];