Skip to content

Feature/dr 4029/facet filters#537

Merged
sarangj merged 15 commits into
qafrom
feature/DR-4029/facet-filters
Apr 1, 2026
Merged

Feature/dr 4029/facet filters#537
sarangj merged 15 commits into
qafrom
feature/DR-4029/facet-filters

Conversation

@avertrees

@avertrees avertrees commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Ticket:

This PR does the following:

Open questions

How has this been tested? How should a reviewer test this?

Accessibility concerns or updates

Checklist:

  • I have added relevant accessibility documentation for this pull request.
  • All new and existing tests passed.
  • I have updated the CHANGELOG.md.

@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
digital-collections Ready Ready Preview, Comment Apr 1, 2026 1:16pm

Request Review

@avertrees avertrees added the WIP Work in progress (don't merge) label Mar 18, 2026
Comment thread app/src/utils/apiClients/apiClients.tsx Outdated
@avertrees avertrees removed the WIP Work in progress (don't merge) label Mar 24, 2026
This manifest method is unused and was previously removed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for dynamic “facet filter” option loading by introducing a new Next.js API route that proxies facet-option requests to the Collections API, and updating the filter modal to fetch its option list based on the current search query params.

Changes:

  • Added CollectionsApi.getFacetOptions for retrieving facet option lists from the Collections API.
  • Added /api/search/facets/[facet] route handler to expose facet options to the client.
  • Updated SelectFilterModal to fetch facet options on open and filter/paginate them client-side (plus related test mocks).

Reviewed changes

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

Show a summary per file
File Description
package-lock.json Large dependency/lockfile update included in the PR.
app/src/utils/fetchApi/fetchApi.ts Replaced logger usage with console.error in error handling.
app/src/utils/apiClients/apiClients.tsx Added Collections API client method for facet option retrieval.
app/src/components/search/filters/selectFilterModal.tsx Fetches facet options via new API route; client-side filtering/pagination.
app/src/components/search/filters/selectFilterModal.test.tsx Added fetch mocking for newly introduced facet-option requests.
app/src/components/search/filters/selectFilterGrid.test.tsx Updated navigation mocks to include useSearchParams.
app/src/components/search/filters/selectFilter.test.tsx Updated navigation mocks to include useSearchParams.
app/api/search/facets/[facet]/route.tsx New route handler to proxy facet-option requests.

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

Comment thread app/src/utils/fetchApi/fetchApi.ts
Comment thread app/src/utils/apiClients/apiClients.tsx
Comment thread app/src/utils/apiClients/apiClients.tsx
Comment thread app/src/components/search/filters/selectFilterModal.tsx Outdated
Comment thread app/src/components/search/filters/selectFilterModal.tsx
Comment thread app/src/components/search/filters/selectFilterModal.tsx Outdated
Comment thread app/api/search/facets/[facet]/route.tsx
Comment on lines +4 to +23
export const GET = async (
request: NextRequest,
{ params }: { params: { facet: string } }
) => {
const searchParams = request.nextUrl.searchParams;
const q = searchParams.get("q") || "";
const filters = searchParams.get("filters") || "";
try {
const response = await CollectionsApi.getFacetOptions(
params.facet,
q,
filters
);
return NextResponse.json(response, { status: 200 });
} catch (error: any) {
return NextResponse.json(
{ error: error?.message || "Unknown error" },
{ status: 500 }
);
}

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

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

There are Jest API tests for other route handlers under __tests__/api/*, but this new /api/search/facets/[facet] route doesn’t have coverage. Please add tests for the 200 path (returns facet options) and an error path (upstream failure → 500) to keep API handler behavior stable.

Copilot uses AI. Check for mistakes.
sarangj added 2 commits March 31, 2026 14:29
  - Remove unused state
  - pass query string from params a dependency
  - handle non-ok response from API
@sarangj sarangj merged commit 1694f53 into qa Apr 1, 2026
9 checks passed
@sarangj sarangj deleted the feature/DR-4029/facet-filters branch April 1, 2026 13:39
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.

5 participants