Skip to content

Dashboard search page renders blank: SearchComponent reads the throwing filters ViewChild getter during initial change detection #6328

Description

@yangzhang75

What happened?

Navigating to the dashboard search page (/dashboard/search, e.g. by typing a query in the top search bar and pressing Enter) renders a blank results area — no results, no empty-state, nothing. The search request succeeds and the autocomplete dropdown still shows suggestions; only the results page fails to render.

The browser console shows this error repeating on every change-detection cycle:

ERROR Error: Property cannot be accessed before it is initialized.
    at get filters (search.component.ts:75:11)
    at SearchComponent_Template (search.component.html:86:33)

Root cause

SearchComponent exposes its FiltersComponent child through a @ViewChild getter that throws until the view is initialized:

private _filters?: FiltersComponent;
@ViewChild(FiltersComponent)
get filters(): FiltersComponent {
  if (this._filters) return this._filters;
  throw new Error("Property cannot be accessed before it is initialized.");
}

The template binds a search-results input directly to this getter:

<texera-search-results [searchKeywords]="this.filters.getSearchKeywords()" ...>

Angular re-evaluates template expressions on every change-detection pass, including the first render — which happens before the @ViewChild query resolves and the filters setter assigns _filters. So on first render _filters is undefined, the getter hits its throw, the exception aborts SearchComponent's rendering, and the results area never mounts → blank page.

The component and template are unchanged from earlier releases; the throw only started firing after the Angular 21 upgrade, whose change-detection ordering now evaluates that sibling binding before the #filters @ViewChild is populated. A getter that can throw should not be referenced from a template binding.

How to reproduce?

  1. Log in and open the dashboard.
  2. Type any keyword in the top search bar and press Enter (or go to /dashboard/search?q=...).
  3. The results area is blank; the console shows the error above.
Screen.Recording.2026-07-10.at.6.08.41.PM.mov

Version/Branch

1.3.0-incubating-SNAPSHOT (main)

Commit Hash (Optional)

No response

What browsers are you seeing the problem on?

No response

Relevant log output

ERROR Error: Property cannot be accessed before it is initialized.
    at get filters (search.component.ts:75:11)
    at SearchComponent_Template (search.component.html:86:33)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions