fix: 多配方跳过重名时正确加载下一条,不覆盖数据
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Failing after 5s
Test / e2e-test (push) Has been skipped
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Failing after 5s
PR Preview / deploy-preview (pull_request) Has been skipped

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 22:56:18 +00:00
parent 41de9b593b
commit 341cdb60bf

View File

@@ -1052,12 +1052,28 @@ async function saveCurrentRecipe() {
if (result === false) {
// Skipped — but if in multi-recipe queue, load next
if (parsedCurrentIndex.value >= 0) {
parsedRecipes.value.splice(parsedCurrentIndex.value, 1)
const skipIdx = parsedCurrentIndex.value
// Prevent syncFormToParsed from overwriting next recipe
parsedCurrentIndex.value = -1
parsedRecipes.value.splice(skipIdx, 1)
if (parsedRecipes.value.length > 0) {
loadParsedIntoForm(Math.min(parsedCurrentIndex.value, parsedRecipes.value.length - 1))
const next = Math.min(skipIdx, parsedRecipes.value.length - 1)
parsedCurrentIndex.value = next
formName.value = parsedRecipes.value[next].name
const cocoIng = parsedRecipes.value[next].ingredients.find(i => i.oil === '椰子油')
const eoIngs = parsedRecipes.value[next].ingredients.filter(i => i.oil !== '椰子油')
formIngredients.value = eoIngs.length > 0
? eoIngs.map(i => ({ ...i, _search: i.oil, _open: false }))
: [{ oil: '', drops: 1, _search: '', _open: false }]
if (cocoIng) {
formCocoRow.value = { oil: '椰子油', drops: cocoIng.drops, _search: '椰子油', _open: false }
formVolume.value = 'single'
} else {
formCocoRow.value = null
formVolume.value = ''
}
ui.showToast('已跳过,请处理下一条')
} else {
parsedCurrentIndex.value = -1
closeOverlay()
}
}