Skip to content

Commit f25d534

Browse files
Bowl42claude
andcommitted
fix(search): save index even when some pages fail to load
When the search plugin indexes pages in auto mode, if any page fails to load (e.g. 404), the fetch promise rejects with no error handler. This means `count` never reaches `len`, so `saveData` is never called and the entire search index is lost — even for pages that loaded successfully. Add an error handler to the `.then()` call that still increments the counter, ensuring the search index is saved with whatever pages were successfully fetched. Fixes #2674 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f4c37e0 commit f25d534

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/plugins/search/search.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ export async function init(config, vm) {
338338
await saveData(config.maxAge, expireKey);
339339
}
340340
},
341+
async _error => {
342+
if (len === ++count) {
343+
await saveData(config.maxAge, expireKey);
344+
}
345+
},
341346
);
342347
});
343348
}

0 commit comments

Comments
 (0)