aglinxinyuan opened a new pull request, #8701:
URL: https://github.com/apache/texera/pull/8701

   ### What changes were proposed in this PR?
   
   **Root cause.** The dashboard search bar searches every resource kind (`type 
= null`). Since #7930 that query returns model rows too, and 
`SearchService.search` keeps them. `SearchBarComponent.convertToName` had no 
model branch, so a model row threw `Unexpected type in SearchResult.` inside 
the `switchMap` feeding the component's only search subscription. That 
subscription has no error handler, so the throw ended it and every later 
keystroke was dropped until reload.
   
   ```
   Before:  type "my" -> a model matches -> convertToName throws -> 
subscription closed
            type "wf" -> no request, no suggestions (rest of the session)
   After:   type "my" -> "my-model" suggested
            a failed request or unnameable row -> [] for that query -> type 
"wf" -> searches as normal
   ```
   
   Two changes:
   
   1. `convertToName` names model rows with `new 
DashboardEntry(resultItem.model).name`, the same way as the other kinds.
   2. The per-query observable in `getSearchResults` ends in `catchError(() => 
of([]))`.
   
   **Why the `catchError`.** The first change fixes this trigger. It does not 
stop the next one: #7930 updated the `SearchService` filter but not 
`convertToName`, and a stale second list of kinds will drift again. HTTP errors 
end the same subscription today as well, because both interceptors rethrow. 
That covers a 5xx, a dropped connection and a 401. Putting the catch on the 
inner, per-query observable means a bad response costs that query's 
suggestions, and the next keystroke searches again. A failed query is not 
cached, so typing the same text again retries. This matches the per-request 
`catchError(() => of([]))` that `FiltersComponent` already uses for the same 
reason. The `SearchService` comment claiming the autocomplete has no error 
handler is corrected to match.
   
   ### Any related issues, documentation, discussions?
   
   Closes #8700
   
   ### How was this PR tested?
   
   Tests came first. Four new cases in `search-bar.component.spec.ts` failed on 
unchanged source, and all 14 pass with the fix:
   
   | Case | Pins |
   | --- | --- |
   | `convertToName` on a model-only row | returns the model's name |
   | model-only search response | the model's name is listed |
   | response with an unnameable row | that query lists nothing; the next query 
still searches and lists its results |
   | failed request (HTTP 500) | that query lists nothing and is not cached; 
retrying the same query hits the server and lists results |
   
   Mutation check: dropping only the `catchError` makes the last two fail, and 
dropping only the model branch makes the first two fail.
   
   From `frontend/`:
   
   - `npx ng test --watch=false --include='**/search-bar.component.spec.ts'`: 
14 passed.
   - `yarn --cwd frontend format:ci`: clean.
   - `node node_modules/typescript/bin/tsc -p src/tsconfig.spec.json --noEmit`: 
no errors.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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