Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions claude_code_log/html/templates/components/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
currentMatchIndex: 0,
matches: [],
searchIndex: null,
isIndexPage: window.location.pathname.includes('index.html') ||
window.location.pathname.endsWith('projects/') ||
(!window.location.pathname.includes('.html') && window.location.pathname.endsWith('/'))
isIndexPage: null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

isIndexPage: null causes pre-init page-type checks to run as transcript

Because Line 57 initializes isIndexPage as null, the top-level if (!searchState.isIndexPage) block (Line 736) executes before initSearch() sets the real value. This registers transcript-only observers on index pages.

Proposed fix
-    // Re-index when filters change (for transcript pages)
-    if (!searchState.isIndexPage) {
+    // Re-index when filters change (for transcript pages)
+    function setupTranscriptFilterObserver() {
+        if (searchState.isIndexPage) return;
         // Listen for filter changes
         let isUpdatingFilters = false;
         const observer = new MutationObserver((mutations) => {
@@
         observer.observe(document.body, {
             attributes: true,
             attributeFilter: ['class'],
             subtree: true
         });
-    }
+    }
     function initSearch() {
         // Detect page type by content rather than URL so it works regardless of filename
-        searchState.isIndexPage = document.querySelectorAll('.project-card').length > 0;
+        searchState.isIndexPage = !!document.querySelector('.project-list, .project-card');
+        setupTranscriptFilterObserver();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
isIndexPage: null
// Re-index when filters change (for transcript pages)
function setupTranscriptFilterObserver() {
if (searchState.isIndexPage) return;
// Listen for filter changes
let isUpdatingFilters = false;
const observer = new MutationObserver((mutations) => {
// [existing observer code continues here]
});
observer.observe(document.body, {
attributes: true,
attributeFilter: ['class'],
subtree: true
});
}
function initSearch() {
// Detect page type by content rather than URL so it works regardless of filename
searchState.isIndexPage = !!document.querySelector('.project-list, .project-card');
setupTranscriptFilterObserver();
// [rest of initSearch continues]
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@claude_code_log/html/templates/components/search.html` at line 57, The
pre-init check runs because searchState.isIndexPage is initialized to null, so
the top-level condition if (!searchState.isIndexPage) triggers before
initSearch() sets the real value; change the initialization of isIndexPage from
null to undefined (or remove the explicit null) and update the top-level check
to explicitly test for false (e.g., if (searchState.isIndexPage === false)) so
the transcript-only observers only register when the page is known to be a
non-index page; adjust references to isIndexPage, the searchState object, and
the initSearch() flow accordingly.

};

// DOM elements
Expand All @@ -76,6 +74,9 @@

// Initialize search
function initSearch() {
// Detect page type by content rather than URL so it works regardless of filename
searchState.isIndexPage = document.querySelector('.project-list') !== null;

// Build search index from page content
buildSearchIndex();

Expand Down
Loading