Skip to content

Admin search - #409

Open
TimPham622 wants to merge 3 commits into
compsci-adl:mainfrom
TimPham622:admin-search
Open

TimPham622 wants to merge 3 commits into
compsci-adl:mainfrom
TimPham622:admin-search

Conversation

@TimPham622

Copy link
Copy Markdown
Contributor

Description

Improve the member search on the admin panel

Changes Made

update search so that it covers all members, regardless of the current page
changed memberform to use the full list when searching

Related Issues

Fixes #408

Additional Notes

Add any other notes or screenshots that might be helpful for the reviewers.

@TimPham622
TimPham622 deployed to Development August 15, 2026 12:00 — with GitHub Actions Active
Comment thread src/app/admin/MemberForm.tsx Outdated
Comment thread src/app/admin/page.tsx
@TimPham622
TimPham622 deployed to Development August 20, 2026 08:27 — with GitHub Actions Active
Comment thread src/app/admin/page.tsx
totalPages,
};
};
const queryAllMembers = async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Running findMany() without a limit fetches every single member from the database on every page load and sends the entire table to the client component in the HTML/RSC payload. As the member table grows over time, this will significantly degrade page load times and client-side memory usage.

Comment thread src/app/admin/page.tsx
const page = parseInt(searchParams?.page || '1', 10);
const { members, totalPages } = await queryMembers(page);
const [{ members, totalPages }, allMembers] = await Promise.all([
queryMembers(page),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

queryMembers(page) is a subset of queryAllMembers(), so it's querying the database twice for overlapping records and serializing duplicate data.

Comment thread src/app/admin/page.tsx
<div className="w-full border-4 border-black bg-white px-8 py-8 text-black md:px-12 md:py-12">
<MemberForm members={members} />
<MemberForm members={members} allMembers={allMembers} />
<PaginationControls currentPage={page} totalPages={totalPages} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since there is no member table on this page, PaginationControls now only paginates the initial blank-query dropdown in Autocomplete. As soon as a user starts typing, it searches allMembers regardless of the current page. This makes PaginationControls confusing and redundant.


const getMemberStr = (member: Member) => `${member.email} - ${member.firstName} ${member.lastName}`;

const getMemberSearchStr = (member: Member) =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The only difference between getMemberSearchStr and getMemberStr is omitting " - ". Substring matching (.includes(query)) on getMemberStr already matches email, first name, and last name equally well without needing a separate search string formatter.

This branch was successfully deployed

1 active deployment
Development — 18cb998c Deployed Aug 27, 2026 by TimPham622 via Build #425
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.

[Feature Request]Improve the member search on the admin panel

3 participants