Skip to content

webview: Fix Template Gallery search inconsistency between language search and…#2347

Open
gavin-aguiar wants to merge 2 commits into
microsoft:mainfrom
gavin-aguiar:gaaguiar/search_fix
Open

webview: Fix Template Gallery search inconsistency between language search and…#2347
gavin-aguiar wants to merge 2 commits into
microsoft:mainfrom
gavin-aguiar:gaaguiar/search_fix

Conversation

@gavin-aguiar

Copy link
Copy Markdown
Contributor

Description:

Fixes: microsoft/vscode-azurefunctions#5072

Problem

In the Template Gallery, searching a language (e.g. ".NET") returned a different set than selecting the matching language filter chip. The .NET chip showed 21 templates; searching ".NET" showed only 1. Fixes #5072.

Root cause

The language filter matches through languageFilterMap (CSharp → dotnet), but the search predicate in applyFilters only checked displayName, shortDescription, and tags — never the template's languages or their display names. So ".NET" only matched the one template with ".NET" literally in its name.

Fix

  • Thread languageDisplayNames into the gallery filter and extend the search to also match each template's language keys and their display names, so language search stays consistent with the filter chips.
  • Extract createApplyFilters into a pure applyFilters.ts module (no React imports) to make the logic unit-testable.
  • Add test/TemplateGallery/applyFilters.test.ts covering search/filter parity, case-insensitivity, raw-key matching, and a no-languages guard.

@gavin-aguiar gavin-aguiar requested a review from a team as a code owner June 16, 2026 22:06
Copilot AI review requested due to automatic review settings June 16, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR extracts Template Gallery filtering logic into a standalone, unit-testable module and enhances search to match language display names (e.g., “.NET”) consistently with language filter chips.

Changes:

  • Added createApplyFilters helper module and expanded search to include language keys + display names.
  • Updated TemplateGalleryView reducer to consume the extracted filter helper.
  • Added unit tests validating search/filter parity and edge cases.

Reviewed changes

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

File Description
webview/src/webview/TemplateGallery/applyFilters.ts New shared filtering/search implementation, decoupled from React for unit testing.
webview/src/webview/TemplateGallery/TemplateGalleryView.tsx Replaces inline filtering logic with the extracted createApplyFilters.
webview/test/TemplateGallery/applyFilters.test.ts Adds unit tests for filtering/search behavior, including display-name search.

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

Comment thread webview/src/webview/TemplateGallery/applyFilters.ts
Comment thread webview/test/TemplateGallery/applyFilters.test.ts
Comment thread webview/src/webview/TemplateGallery/applyFilters.ts Outdated
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.

Template Gallery shows inconsistent templates between ".NET" search and .NET language filter

2 participants