docs: preload and accelerate local search - #2569
Closed
karakanb wants to merge 1 commit into
Closed
Conversation
Contributor
Prompt To Fix All With AI### Issue 1
docs/.vitepress/config.mjs:52
**Handle preload loader rejections**
A failed background index import rejects without a handler, producing an unhandled promise rejection even though search can retry the loader when opened.
```suggestion
`${searchIndexDeclaration}\n\n// Download the index while the reader is browsing instead of after search opens.\nObject.values(localSearchIndex).forEach((load) => load().catch(() => {}))`,
```
### Issue 2
docs/.vitepress/config.mjs:22-25
**Shorten the plugin commentary**
This four-line comment restates the upstream behavior, motivation, and implementation effects rather than providing the repository-required concise, location-specific explanation.
```suggestion
// Preload and tune VitePress local search for the large documentation index.
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "docs: preload and accelerate local searc..." | Re-trigger Greptile |
| return code | ||
| .replace( | ||
| searchIndexDeclaration, | ||
| `${searchIndexDeclaration}\n\n// Download the index while the reader is browsing instead of after search opens.\nObject.values(localSearchIndex).forEach((load) => load())`, |
Contributor
There was a problem hiding this comment.
Handle preload loader rejections
A failed background index import rejects without a handler, producing an unhandled promise rejection even though search can retry the loader when opened.
Suggested change
| `${searchIndexDeclaration}\n\n// Download the index while the reader is browsing instead of after search opens.\nObject.values(localSearchIndex).forEach((load) => load())`, | |
| `${searchIndexDeclaration}\n\n// Download the index while the reader is browsing instead of after search opens.\nObject.values(localSearchIndex).forEach((load) => load().catch(() => {}))`, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/.vitepress/config.mjs
Line: 52
Comment:
**Handle preload loader rejections**
A failed background index import rejects without a handler, producing an unhandled promise rejection even though search can retry the loader when opened.
```suggestion
`${searchIndexDeclaration}\n\n// Download the index while the reader is browsing instead of after search opens.\nObject.values(localSearchIndex).forEach((load) => load().catch(() => {}))`,
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comment on lines
+22
to
+25
| // VitePress intentionally lazy-loads local search and waits 200 ms after each | ||
| // keystroke. That is a good default for small sites, but our large local index | ||
| // made opening and using search feel sluggish. Keep the search code and index | ||
| // warm, and use a short debounce so interaction stays below a frame or two. |
Contributor
There was a problem hiding this comment.
This four-line comment restates the upstream behavior, motivation, and implementation effects rather than providing the repository-required concise, location-specific explanation.
Suggested change
| // VitePress intentionally lazy-loads local search and waits 200 ms after each | |
| // keystroke. That is a good default for small sites, but our large local index | |
| // made opening and using search feel sluggish. Keep the search code and index | |
| // warm, and use a short debounce so interaction stays below a frame or two. | |
| // Preload and tune VitePress local search for the large documentation index. |
Rule Used: What: Comments should be concise and targeted to s... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/.vitepress/config.mjs
Line: 22-25
Comment:
**Shorten the plugin commentary**
This four-line comment restates the upstream behavior, motivation, and implementation effects rather than providing the repository-required concise, location-specific explanation.
```suggestion
// Preload and tune VitePress local search for the large documentation index.
```
**Rule Used:** What: Comments should be concise and targeted to s... ([source](https://app.greptile.com/bruin/-/custom-context?memory=6adfbd2b-1b23-4560-9e00-6254e7cb7c70))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
fastLocalSearchindocs/.vitepress/config.mjsthat injects an idle-timeimport('./VPLocalSearchBox.vue')to warm the local-search chunk so search UI opens without lazy-load delay.localSearchIndexloaders while the reader is browsing so the ~2MB index is available before the user opens search.{ debounce: 200, immediate: true }to{ debounce: 25, immediate: true }to tighten query-response latency.Testing
npm run docs:buildto validate the site build and asset generation, and it completed successfully.git diff --checkandgit status --shortto validate the working tree and produced no actionable issues.node .search-perf.cjs), but the headless Chromium/Playwright launch was blocked by the environment (snap/chromium and network-proxy download issues), so end-to-end timing could not be collected here.Codex Task