mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 22:05:56 +08:00
fix: minor bug and pr comments regarding better resync
This commit is contained in:
parent
f60492fe62
commit
816fd1c6fb
@ -316,6 +316,7 @@ function ExplorerOptions({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onUpdateQueryHandler = (): void => {
|
const onUpdateQueryHandler = (): void => {
|
||||||
|
console.log('uncaught ued', updatedExtraData);
|
||||||
updateViewAsync(
|
updateViewAsync(
|
||||||
{
|
{
|
||||||
compositeQuery: mapCompositeQueryFromQuery(currentQuery, panelType),
|
compositeQuery: mapCompositeQueryFromQuery(currentQuery, panelType),
|
||||||
@ -524,6 +525,14 @@ function ExplorerOptions({
|
|||||||
color,
|
color,
|
||||||
selectColumns: options.selectColumns,
|
selectColumns: options.selectColumns,
|
||||||
version: 1,
|
version: 1,
|
||||||
|
...// pass this only for logs
|
||||||
|
(sourcepage === DataSource.LOGS
|
||||||
|
? {
|
||||||
|
format: options?.format,
|
||||||
|
maxLines: options?.maxLines,
|
||||||
|
fontSize: options?.fontSize,
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
}),
|
}),
|
||||||
notifications,
|
notifications,
|
||||||
panelType: panelType || PANEL_TYPES.LIST,
|
panelType: panelType || PANEL_TYPES.LIST,
|
||||||
|
@ -58,9 +58,11 @@ async function tracesPreferencesLoader(): Promise<{
|
|||||||
export function usePreferenceLoader({
|
export function usePreferenceLoader({
|
||||||
dataSource,
|
dataSource,
|
||||||
reSync,
|
reSync,
|
||||||
|
setReSync,
|
||||||
}: {
|
}: {
|
||||||
dataSource: DataSource;
|
dataSource: DataSource;
|
||||||
reSync: number;
|
reSync: boolean;
|
||||||
|
setReSync: (value: boolean) => void;
|
||||||
}): {
|
}): {
|
||||||
preferences: Preferences | null;
|
preferences: Preferences | null;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
@ -89,10 +91,18 @@ export function usePreferenceLoader({
|
|||||||
setError(e as Error);
|
setError(e as Error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
// Reset reSync back to false after loading is complete
|
||||||
|
if (reSync) {
|
||||||
|
setReSync(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadPreferences();
|
|
||||||
}, [dataSource, reSync]);
|
// Only load preferences on initial mount or when reSync is true
|
||||||
|
if (loading || reSync) {
|
||||||
|
loadPreferences();
|
||||||
|
}
|
||||||
|
}, [dataSource, reSync, setReSync, loading]);
|
||||||
|
|
||||||
return { preferences, loading, error };
|
return { preferences, loading, error };
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,11 @@ export function usePreferenceSync({
|
|||||||
|
|
||||||
// We are using a reSync state because we have URL updates as well as local storage updates
|
// We are using a reSync state because we have URL updates as well as local storage updates
|
||||||
// and we want to make sure we are always using the latest preferences
|
// and we want to make sure we are always using the latest preferences
|
||||||
const [reSync, setReSync] = useState(0);
|
const [reSync, setReSync] = useState(false);
|
||||||
const { preferences, loading, error } = usePreferenceLoader({
|
const { preferences, loading, error } = usePreferenceLoader({
|
||||||
dataSource,
|
dataSource,
|
||||||
reSync,
|
reSync,
|
||||||
|
setReSync,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { updateColumns, updateFormatting } = usePreferenceUpdater({
|
const { updateColumns, updateFormatting } = usePreferenceUpdater({
|
||||||
|
@ -46,7 +46,7 @@ export function usePreferenceUpdater({
|
|||||||
}: {
|
}: {
|
||||||
dataSource: DataSource;
|
dataSource: DataSource;
|
||||||
mode: string;
|
mode: string;
|
||||||
setReSync: Dispatch<SetStateAction<number>>;
|
setReSync: Dispatch<SetStateAction<boolean>>;
|
||||||
setSavedViewPreferences: Dispatch<SetStateAction<Preferences | null>>;
|
setSavedViewPreferences: Dispatch<SetStateAction<Preferences | null>>;
|
||||||
}): {
|
}): {
|
||||||
updateColumns: (newColumns: BaseAutocompleteData[]) => void;
|
updateColumns: (newColumns: BaseAutocompleteData[]) => void;
|
||||||
@ -63,11 +63,11 @@ export function usePreferenceUpdater({
|
|||||||
return {
|
return {
|
||||||
updateColumns: (newColumns: BaseAutocompleteData[]): void => {
|
updateColumns: (newColumns: BaseAutocompleteData[]): void => {
|
||||||
updater.updateColumns(newColumns, mode);
|
updater.updateColumns(newColumns, mode);
|
||||||
setReSync((prev: number) => prev + 1);
|
setReSync(true);
|
||||||
},
|
},
|
||||||
updateFormatting: (newFormatting: FormattingOptions): void => {
|
updateFormatting: (newFormatting: FormattingOptions): void => {
|
||||||
updater.updateFormatting(newFormatting, mode);
|
updater.updateFormatting(newFormatting, mode);
|
||||||
setReSync((prev: number) => prev + 1);
|
setReSync(true);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user