feat: do not use empty phrase for deleted chords

This commit is contained in:
2023-12-16 15:20:44 +01:00
parent b679aa377a
commit 766bc44a85
5 changed files with 28 additions and 13 deletions

View File

@@ -39,8 +39,8 @@
if (!port) return
$syncStatus = "uploading"
for (const [id, {actions, phrase}] of $overlay.chords) {
if (phrase.length > 0) {
for (const [id, {actions, phrase, deleted}] of $overlay.chords) {
if (!deleted) {
if (id !== JSON.stringify(actions)) {
const existingChord = await port.getChordPhrase(actions)
if (
@@ -109,9 +109,7 @@
number[],
number[],
]
$deviceChords = $chords
.map(({actions, phrase}) => ({actions, phrase}))
.filter(({phrase}) => phrase.length > 1)
$deviceChords = $chords.filter(({deleted}) => !deleted).map(({actions, phrase}) => ({actions, phrase}))
$deviceSettings = $settings.map(({value}) => value)
$changes = []
$syncStatus = "done"