Using UUIDs to identify tracks (instead of a numerical index) to make it easier to synchronize databases.

This commit is contained in:
vdv committed 2022-09-23 15:07:39 +02:00
1 parent a212841c6c
commit bb2130793d
1 file changed
+1 -4
+1 -4
View File
@@ -1,12 +1,10 @@
import { createSlice } from '@reduxjs/toolkit';
interface TracksState {
index: number;
tracks: { [index: string]: any };
}
const initialTracks: TracksState = {
index: 0,
tracks: {},
};
@@ -18,8 +16,7 @@ const tracksSlice = createSlice({
state.tracks[action.payload.id] = action.payload.track;
},
push: (state, action) => {
state.tracks['$' + state.index] = action.payload;
state.index++;
state.tracks[crypto.randomUUID()] = action.payload;
},
},
});