use ids instead of alphabets (index)

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-08-20 21:42:02 +02:00
parent a5b06c8af0
commit a6b3d341c1
9 changed files with 47 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ import {
startOfDay,
} from 'date-fns';
import { shortId } from '@openpanel/common';
import {
alphabetIds,
getDefaultIntervalByDates,
@@ -91,7 +92,7 @@ export const reportSlice = createSlice({
addEvent: (state, action: PayloadAction<Omit<IChartEvent, 'id'>>) => {
state.dirty = true;
state.events.push({
id: alphabetIds[state.events.length]!,
id: shortId(),
...action.payload,
});
},
@@ -129,7 +130,7 @@ export const reportSlice = createSlice({
) => {
state.dirty = true;
state.breakdowns.push({
id: alphabetIds[state.breakdowns.length]!,
id: shortId(),
...action.payload,
});
},