Skip to content

refactor(grids): cleanup search snippets#5851

Merged
kdinev merged 3 commits intovnextfrom
dpetev/grid-search-samples
Apr 1, 2026
Merged

refactor(grids): cleanup search snippets#5851
kdinev merged 3 commits intovnextfrom
dpetev/grid-search-samples

Conversation

@damyanpetev
Copy link
Copy Markdown
Member

lastSearchInfo.matchInfoCache.length -> lastSearchInfo.matchCount and removed the check for the entire object since that does nothing
Matching samples PR IgniteUI/igniteui-angular-samples#3496

Checklist:

  • check topic's TOC/menu and paragraph headings
  • Include TOC topic labels in topic content has a valuable update, it's new or considered as preview\ beta
  • link to other topics using ../relative/path.md
  • at the References section at the end of the topic add links to topics, samples, etc
  • reference API documentation instead of adding a section with API

  • use valid component names - [Data] Grid, IgxSelectComponent, <igx-combo>
  • use spell checker tool (VS Code, Grammarly, Microsoft Editor)
  • add inline code blocks for the names of classes / tags / properties
  • add language descriptor for the code blocks
  • check broken links (use browser add-on)
  • check if sample is working and fully visible in the topic
  • check if sample is working and fully visible in the StackBlitz
  • check if code blocks match the code in StackBlitz demo


  • do not resolve requested changes (leave that to the reviewer)
  • add pending-localization label when the review of the PR is done
  • add a member from the localization team to translate it

onlyexeption
onlyexeption previously approved these changes Jun 14, 2024
Copilot AI review requested due to automatic review settings April 1, 2026 12:54
@kdinev kdinev changed the base branch from master to vnext April 1, 2026 12:54
@kdinev kdinev dismissed onlyexeption’s stale review April 1, 2026 12:54

The base branch was changed.

@kdinev kdinev merged commit 6247a47 into vnext Apr 1, 2026
5 checks passed
@kdinev kdinev deleted the dpetev/grid-search-samples branch April 1, 2026 12:56
Copy link
Copy Markdown
Contributor

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

Updates the Grid search documentation snippets to reflect a refactored search API surface by switching from lastSearchInfo.matchInfoCache.length to lastSearchInfo.matchCount, and simplifying the sample templates accordingly.

Changes:

  • Replace usage of lastSearchInfo.matchInfoCache.length with lastSearchInfo.matchCount in results-count snippets.
  • Remove the outer *ngIf="@@igObjectRef.lastSearchInfo" wrapper in results display snippets (across EN/JP/KR docs).

Reviewed changes

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

File Description
kr/components/grids_templates/search.md Updates search result count snippets to use matchCount and adjusts template conditions.
jp/components/grids_templates/search.md Updates search result count snippets to use matchCount and adjusts template conditions.
en/components/grids_templates/search.md Updates search result count snippets to use matchCount and adjusts template conditions.

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

Comment on lines +174 to +178
<div class="resultsText">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results
</span>
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0">
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The template now accesses @@igObjectRef.lastSearchInfo.matchCount without guarding lastSearchInfo. If lastSearchInfo is undefined before the first findNext/findPrev call, Angular will throw when evaluating the *ngIf expressions. Consider restoring the *ngIf="@@igObjectRef.lastSearchInfo" guard or using the safe-navigation operator (e.g., lastSearchInfo?.matchCount).

Copilot uses AI. Check for mistakes.
Comment on lines 324 to 330
<igx-suffix *ngIf="searchText.length > 0">
<div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results
<div class="resultsText">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results
</span>
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0">
No results
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Inside the igx-suffix block, @@igObjectRef.lastSearchInfo.matchCount is used without guarding lastSearchInfo. If searchText is pre-populated (or findNext hasn’t run yet) this can still evaluate with lastSearchInfo undefined and cause a template error. Guard lastSearchInfo or use safe navigation.

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +174
<div class="resultsText">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results
</span>
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0">
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

@@igObjectRef.lastSearchInfo.matchCount is referenced without checking lastSearchInfo first. If lastSearchInfo is undefined before the first search, Angular will throw when evaluating the *ngIf expressions. Consider adding back an *ngIf="@@igObjectRef.lastSearchInfo" guard or using safe navigation (lastSearchInfo?.matchCount).

Copilot uses AI. Check for mistakes.
Comment on lines 319 to 325
<igx-suffix *ngIf="searchText.length > 0">
<div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results
<div class="resultsText">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results
</span>
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0">
No results
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

In this snippet, @@igObjectRef.lastSearchInfo.matchCount is accessed without guarding lastSearchInfo. Even though the suffix is shown when searchText.length > 0, lastSearchInfo can still be undefined (e.g., when searchText is set programmatically before running findNext). Guard lastSearchInfo or use safe navigation.

Copilot uses AI. Check for mistakes.
Comment on lines +154 to +158
<div class="resultsText">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results
</span>
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0">
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

@@igObjectRef.lastSearchInfo.matchCount is used without guarding lastSearchInfo. If lastSearchInfo is undefined before the first findNext/findPrev call, Angular can throw while evaluating these *ngIf expressions. Consider restoring the *ngIf="@@igObjectRef.lastSearchInfo" guard or using safe navigation (lastSearchInfo?.matchCount).

Copilot uses AI. Check for mistakes.
Comment on lines 296 to 302
<igx-suffix *ngIf="searchText.length > 0">
<div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results
<div class="resultsText">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0">
{{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results
</span>
<span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0">
<span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0">
No results
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Within the igx-suffix block, @@igObjectRef.lastSearchInfo.matchCount is accessed without guarding lastSearchInfo. If searchText is initialized programmatically and findNext hasn’t executed yet, this can still error. Guard lastSearchInfo or use safe navigation.

Copilot uses AI. Check for mistakes.
@github-actions github-actions Bot mentioned this pull request Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants