Skip to content

Main → Prod#39

Merged
Sithumli merged 6 commits intoprodfrom
main
Mar 2, 2026
Merged

Main → Prod#39
Sithumli merged 6 commits intoprodfrom
main

Conversation

@Sithumli
Copy link
Copy Markdown
Owner

@Sithumli Sithumli commented Mar 2, 2026

Main → Prod

@Sithumli Sithumli self-assigned this Mar 2, 2026
Copilot AI review requested due to automatic review settings March 2, 2026 13:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Pagefind-backed documentation search UI to the template and wires the build pipeline to generate a searchable index, along with a patch version bump + changelog entry.

Changes:

  • Add a new Search modal component and mount it in the header.
  • Update build scripts to run Pagefind indexing after astro build, and add pagefind as a dev dependency.
  • Bump package version to 1.1.2 and document the change in CHANGELOG.md.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
template/src/components/Search.astro New search trigger + modal UI, client-side Pagefind init/search logic.
template/src/components/Header.astro Replaces placeholder search input with the new Search component.
template/package.json Adds pagefind devDependency and runs Pagefind after Astro build.
template/pnpm-lock.yaml Adds lockfile for the template including Pagefind dependencies.
pnpm-lock.yaml Adds Pagefind to the root lockfile.
package.json Bumps version and updates build script; adds Pagefind devDependency.
CHANGELOG.md Adds 1.1.2 entry for search.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +77 to +88
let searchTimeout = null;

async function initPagefind() {
if (pagefind) return pagefind;
try {
pagefind = await import('/pagefind/pagefind.js');
await pagefind.init();
return pagefind;
} catch (e) {
console.warn('Pagefind not available. Run "pnpm build" to generate the search index.');
return null;
}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

initPagefind() doesn’t cache an in-flight dynamic import/init. If the modal is opened multiple times quickly (or Cmd/Ctrl+K is pressed repeatedly) before the first import resolves, this can trigger multiple concurrent imports/inits. Consider caching a promise (e.g., pagefindPromise) so all callers await the same initialization work.

Suggested change
let searchTimeout = null;
async function initPagefind() {
if (pagefind) return pagefind;
try {
pagefind = await import('/pagefind/pagefind.js');
await pagefind.init();
return pagefind;
} catch (e) {
console.warn('Pagefind not available. Run "pnpm build" to generate the search index.');
return null;
}
let pagefindPromise = null;
let searchTimeout = null;
async function initPagefind() {
if (pagefind) return pagefind;
if (!pagefindPromise) {
pagefindPromise = (async () => {
try {
const module = await import('/pagefind/pagefind.js');
await module.init();
pagefind = module;
return pagefind;
} catch (e) {
console.warn('Pagefind not available. Run "pnpm build" to generate the search index.');
pagefind = null;
pagefindPromise = null;
return null;
}
})();
}
return pagefindPromise;

Copilot uses AI. Check for mistakes.
await pagefind.init();
return pagefind;
} catch (e) {
console.warn('Pagefind not available. Run "pnpm build" to generate the search index.');
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The warning message hard-codes pnpm ("Run "pnpm build"..."). The README supports npm/yarn as well, so this message is misleading for non-pnpm users. Consider making the message package-manager-agnostic (e.g., "Run the build command to generate the search index") or referencing npm run build.

Suggested change
console.warn('Pagefind not available. Run "pnpm build" to generate the search index.');
console.warn('Pagefind not available. Run the build command (e.g., "npm run build") to generate the search index.');

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +113
function openModal() {
const modal = document.getElementById('search-modal');
const input = document.getElementById('search-input');
if (!modal || !input) return;

modal.classList.remove('hidden');
document.body.style.overflow = 'hidden';
input.focus();
initPagefind();
}

function closeModal() {
const modal = document.getElementById('search-modal');
const input = document.getElementById('search-input');
const resultsList = document.getElementById('search-results-list');

if (!modal) return;

if (searchTimeout) clearTimeout(searchTimeout);

modal.classList.add('hidden');
document.body.style.overflow = '';

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The modal sets aria-modal="true" and moves focus to the input on open, but it doesn’t restore focus to the trigger on close or trap focus within the dialog while open. This can strand keyboard/screen-reader users. Consider storing the previously focused element before opening and restoring it on close, and implementing a simple focus trap (Tab/Shift+Tab cycling) while the modal is visible.

Copilot uses AI. Check for mistakes.

### Patch Changes

- 820c898: Search fuctionality
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

Spelling: "Search fuctionality" should be "Search functionality".

Suggested change
- 820c898: Search fuctionality
- 820c898: Search functionality

Copilot uses AI. Check for mistakes.
github-actions bot and others added 2 commits March 2, 2026 18:42
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Sithumli Sithumli merged commit 7388815 into prod Mar 2, 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