fix(recipe): reimport data loss, local file support, and scroll bugs

- Add local file reimport support via _do_reimport_from_local
- Validate source_path BEFORE deleting old recipe (prevent data loss)
- Move delete_recipe after save_recipe (safe ordering)
- Preserve folder location, NSFW level, and carry over user edits
- Remove old timestamp preservation (use current time)
- Add scrollTop reset in resetAndReloadWithVirtualScroll
- Only reload on successful bulk reimport (avoid empty grid)
- Disable preserveScroll for both single and bulk reimport
This commit is contained in:
Will Miao
2026-06-11 21:31:30 +08:00
parent 05f3018495
commit 46cbcf94c8
5 changed files with 154 additions and 35 deletions

View File

@@ -213,6 +213,8 @@ export async function resetAndReloadWithVirtualScroll(options = {}) {
if (scrollSnapshot) {
await restoreScrollPosition(scrollSnapshot);
} else if (state.virtualScroller?.scrollContainer) {
state.virtualScroller.scrollContainer.scrollTop = 0;
}
return result;