create file when routing with no selection

This commit is contained in:
vcoppe
2024-06-15 19:17:27 +02:00
parent ea53a82451
commit fe4cafaa23
3 changed files with 36 additions and 4 deletions

View File

@@ -381,7 +381,9 @@ export function getFileIds(n: number) {
// Helper functions for file operations
export const dbUtils = {
add: (file: GPXFile) => {
file._data.id = getFileIds(1)[0];
if (file._data.id === undefined) {
file._data.id = getFileIds(1)[0];
}
return applyGlobal((draft) => {
draft.set(file._data.id, freeze(file));
});