fix(monitoring): дедупликация точек в истории метрик
addToAllHistory не добавляет повторяющиеся timestamp+node. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -56,6 +56,10 @@ export const useMetricsStore = create<MetricsState>((set, get) => ({
|
|||||||
|
|
||||||
addToAllHistory: (metric) =>
|
addToAllHistory: (metric) =>
|
||||||
set((state) => {
|
set((state) => {
|
||||||
|
const key = `${metric.node}|${metric.timestamp}`;
|
||||||
|
if (state.allHistory.some((m) => `${m.node}|${m.timestamp}` === key)) {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
const newAll = [...state.allHistory, metric].slice(-MAX_HISTORY);
|
const newAll = [...state.allHistory, metric].slice(-MAX_HISTORY);
|
||||||
return { allHistory: newAll };
|
return { allHistory: newAll };
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user