Skip to content

Commit 669e863

Browse files
authored
docs: Merge pull request #22304 from unoplatform/copilot/sub-pr-22293
fix: address Algolia DocSearch PR review comments
2 parents ca38e08 + 5aad788 commit 669e863

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

doc/templates/uno/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ body {
2929

3030
.toc {
3131
background-color: transparent;
32-
padding: 0 24px 24px 24px;
32+
padding: 12px 24px 24px 24px;
3333
margin: 0;
3434
}
3535
}

doc/templates/uno/partials/scripts.tmpl.partial

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,34 @@ mermaid.init(undefined, ".lang-mermaid");
1818
</script>
1919

2020
<!-- Algolia DocSearch -->
21-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@4.4.0" />
22-
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@4.4.0"></script>
21+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@4" />
22+
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@4"></script>
2323
<script>
2424
/**
2525
* Initialize Algolia DocSearch
2626
* This function initializes DocSearch for the element with id 'docsearch'.
2727
*/
28+
let docSearchRetryCount = 0;
29+
const MAX_DOCSEARCH_RETRIES = 50; // Maximum retry duration: 5 seconds (50 attempts * 100ms intervals)
30+
2831
function initializeDocSearch() {
2932
console.log("initializeDocSearch called");
3033

3134
// Check if docsearch function is available
3235
if (typeof docsearch === 'undefined') {
33-
console.log("DocSearch library not loaded yet, retrying...");
36+
docSearchRetryCount++;
37+
if (docSearchRetryCount >= MAX_DOCSEARCH_RETRIES) {
38+
console.error("DocSearch library failed to load after " + MAX_DOCSEARCH_RETRIES + " retries");
39+
return;
40+
}
41+
console.log("DocSearch library not loaded yet, retrying... (attempt " + docSearchRetryCount + "/" + MAX_DOCSEARCH_RETRIES + ")");
3442
setTimeout(initializeDocSearch, 100);
3543
return;
3644
}
3745

46+
// Reset retry count on success
47+
docSearchRetryCount = 0;
48+
3849
try {
3950
const searchBox = document.getElementById("docsearch");
4051

0 commit comments

Comments
 (0)