fix: imported chords not filtered

This commit is contained in:
2023-11-18 18:49:15 +01:00
parent a0fe925ea9
commit 8e5692ca59

View File

@@ -109,9 +109,9 @@ export function restoreFromFile(
export function getChangesFromChordFile(file: CharaChordFile) { export function getChangesFromChordFile(file: CharaChordFile) {
const changes: Change[] = [] const changes: Change[] = []
const existingChords = new Set(get(chords).map(({phrase, actions}) => JSON.stringify({phrase, actions}))) const existingChords = new Set(get(chords).map(({phrase, actions}) => JSON.stringify([actions, phrase])))
for (const [input, output] of file.chords) { for (const [input, output] of file.chords) {
if (existingChords.has(JSON.stringify({actions: input, phrase: output}))) { if (existingChords.has(JSON.stringify([input, output]))) {
continue continue
} }
changes.push({ changes.push({