@@ -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