yangzhang75 opened a new issue, #6328:
URL: https://github.com/apache/texera/issues/6328

   ### 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:
   
   ```ts
   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:
   
   ```html
   <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.
   
   
https://github.com/user-attachments/assets/3413f420-e807-4611-bbd4-bfe6ead2f795
   
   ### 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
   
   ```shell
   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)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to