From 450948507d983e56ecf3a82114b7fd0911b9a423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sat, 13 Jul 2024 15:42:16 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A8=20Fix=20save=20existing=20song?= =?UTF-8?q?s=20from=20song=20preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/modals/SetlistSet.vue | 2 +- frontend/src/modals/SongSet.vue | 6 ++++-- frontend/src/views/SongShow.vue | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/modals/SetlistSet.vue b/frontend/src/modals/SetlistSet.vue index db8cbd23..b2dcfe39 100644 --- a/frontend/src/modals/SetlistSet.vue +++ b/frontend/src/modals/SetlistSet.vue @@ -140,7 +140,7 @@
- { song.value = {...props.initialSong}; }; watch(() => props.active, () => initInput()); +onMounted(() => initInput()); // active modals state const showModal = reactive({ @@ -336,7 +337,7 @@ const createSlug = () => { return urlify(song.value.title) + '-' + song.value.language; }; -// add or save edits of song to db +// add or save edits of song to db const busy = ref(false); const setSong = () => { const slug = createSlug(); @@ -345,6 +346,7 @@ const setSong = () => { error.language = song.value.language == ''; error.content = song.value.content == ''; error.slug = props.existing && props.id == slug ? false : props.songs.hasOwnProperty(slug); + console.log(slug, props.existing, props.id, props.songs.hasOwnProperty(slug)); // no errors: start saving song data if (!errors.value) { busy.value = true; diff --git a/frontend/src/views/SongShow.vue b/frontend/src/views/SongShow.vue index 31642a47..2dd68303 100644 --- a/frontend/src/views/SongShow.vue +++ b/frontend/src/views/SongShow.vue @@ -385,8 +385,8 @@ const position = computed(() => props.ready.setlists && urlSetlist && urlKey // get song object from db as soon as songs have finished loading const song = computed(() => { - if (props.ready.songs) { - return props.songs[songId]; + if (songId && props.ready.songs) { + return { ...props.songs[songId], id: songId }; } return null; }); @@ -401,7 +401,7 @@ const showLanguages = computed(() => { languages.push([sId, props.songs[sId].language]); } } - return languages.sort((a, b) => { + return languages.sort((a, b) => { return a[1] > b[1] ? 1 : -1; }) } else { From da94b48135b271728e76ddc256aaecb14335d9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sat, 13 Jul 2024 15:45:43 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9D=8C=20Remove=20extraneous=20console?= =?UTF-8?q?=20statement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/modals/SongSet.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/modals/SongSet.vue b/frontend/src/modals/SongSet.vue index b31ce6b5..b3802896 100644 --- a/frontend/src/modals/SongSet.vue +++ b/frontend/src/modals/SongSet.vue @@ -346,7 +346,6 @@ const setSong = () => { error.language = song.value.language == ''; error.content = song.value.content == ''; error.slug = props.existing && props.id == slug ? false : props.songs.hasOwnProperty(slug); - console.log(slug, props.existing, props.id, props.songs.hasOwnProperty(slug)); // no errors: start saving song data if (!errors.value) { busy.value = true;