Skip to content

Fix library search matching interface control text#47

Merged
mberman84 merged 1 commit into
Forward-Future:mainfrom
HMAKT99:fix/search-excludes-control-text
Jun 22, 2026
Merged

Fix library search matching interface control text#47
mberman84 merged 1 commit into
Forward-Future:mainfrom
HMAKT99:fix/search-excludes-control-text

Conversation

@HMAKT99

@HMAKT99 HMAKT99 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The homepage library search matched interface control text, so several common words filtered nothing.

updateLibrary() built each row's search haystack from the entire row's textContent:

const searchableText = `${row.dataset.search} ${row.textContent}`;

A loop row's textContent includes the "Copy loop" action button, and — after script.js runs — the injected "Show more" / "Show less" prompt toggle. Because every row contains those strings, typing copy, show, more, or less matched all loops instead of filtering them.

Fix

Snapshot each row's searchable text once at load, reading the .cell-loop content (category, attribution, title, summary, and prompt) before the prompt toggle button is inserted. The cached, pre-normalized value is then reused on every keystroke.

This:

  • excludes the .cell-action "Copy loop" button and the injected toggle from the search index,
  • keeps title / summary / prompt / data-search keyword matching fully intact, and
  • avoids re-reading textContent for all rows on every keystroke.

Verification

  • Before: search copy or show → all 44 loops shown. After: those words match only loops whose content actually contains them.
  • node scripts/check.mjsLoop Library checks passed.
  • node --check site/script.js
  • node scripts/build-skill-catalog.mjs && node scripts/build-loop-pages.mjs && node scripts/build-social-images.mjs → no artifact drift (git status clean apart from site/script.js).
  • npm --prefix worker run check → tests pass.

@HMAKT99

HMAKT99 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for building Loop Library — the agent-native framing and the care in the catalog really show.

This one's a small, self-contained fix. The homepage search built its haystack from each row's full textContent, which now includes the "Copy loop" button and the JS-injected "Show more"/"Show less" toggle — so typing copy, show, more, or less matched every loop. Easy to see before/after: search copy on the live site today and all 44 loops stay. The fix snapshots the .cell-loop text once at load (so it also avoids re-reading textContent on every keystroke) and keeps title/prompt/keyword search intact.

I followed AGENTS.md — node scripts/check.mjs, all three builders, and the worker tests pass locally with no artifact drift. Happy to tweak naming or approach to match your conventions.

@mberman84 mberman84 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The search-indexing change itself is correct and passed the integrated checks/browser verification. One deployment blocker remains: this changes site/script.js without changing the versioned script URL currently referenced as ?v=20260620-newest-first.

The live asset is cacheable for an hour with stale-while-revalidate, so existing visitors can continue receiving the old search behavior after deployment. Please bump the shared script asset version everywhere it is emitted and validated, including the generated loop-page template and scripts/check.mjs, then regenerate affected pages.

@HMAKT99

HMAKT99 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — good catch on the cache angle. Bumped the shared script.js version to 20260621-search-index across the homepage, Learn/Agents pages, the loop-page generator, and the scripts/check.mjs assertions, then regenerated the loop detail pages. node scripts/check.mjs + all three builders are green with no drift.

@HMAKT99

HMAKT99 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@mberman84 this is ready for another look whenever you have a moment — the asset version is bumped and the loop pages regenerated. Thanks for the careful review!

@mberman84 mberman84 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Superseded by the corrected review immediately below.

@mberman84 mberman84 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Correction to my immediately preceding review, whose inline code formatting was stripped by the shell:

The previously requested cache-bust fix is addressed, and the exact head passes node scripts/check.mjs, syntax checks, and all builders. The search-index change itself looks good.

This branch now needs a rebase onto current main before it can be approved. Since this PR branched, #61/#62 moved loop detail pages to the database-backed proxy and removed scripts/build-loop-pages.mjs plus site/loops/**. GitHub reports this head as conflicting, and merging the stale generated-page changes would risk restoring files the new architecture intentionally deleted.

Please rebase onto the latest main, keep the focused site/script.js search-index change, update the surviving shared script references/check assertions to a fresh version, and leave the removed generator/static loop pages deleted. Then rerun node scripts/check.mjs and the relevant asset checks.

@mberman84 mberman84 force-pushed the fix/search-excludes-control-text branch from 072d457 to 1c88752 Compare June 22, 2026 18:17

@mberman84 mberman84 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rebased onto the database-backed main architecture. The focused search-index fix is preserved, stale generated-page artifacts are gone, and the full current CI-equivalent suite passes locally (41/41 Worker tests).

@mberman84 mberman84 merged commit 2e73a74 into Forward-Future:main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants