This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch
gh-readonly-queue/release/v1.2/pr-9228-9bf15b0a1a43f84ec5ca3c9167e25e035fd28fdd
in repository https://gitbox.apache.org/repos/asf/texera.git
commit 4f64f4bfae8f7c81e3f7be2b561e2594f9699bd2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 10 02:36:02 2026 +0000
fix(frontend, v1.2): clear the search bar’s suggestions when the user
changes (#9228)
### What changes were proposed in this PR?
Automated backport of #9090 to `release/v1.2`.
Source: 553ab15b32947fe35ced580c2570284e04b71536 · [automation
run](https://github.com/apache/texera/actions/runs/41014952246)
### Any related issues, documentation, discussions?
Backport of #9090. Originally linked #9089.
### How was this PR tested?
Release-branch CI runs on this branch once the conflicts are resolved
and this PR is marked ready for review.
### Was this PR authored or co-authored using generative AI tooling?
No.
---------
Co-authored-by: Tanishq Gandhi
<[email protected]>
Co-authored-by: Xuan Gu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../user/search-bar/search-bar.component.spec.ts | 20 ++++++++++++++++++++
.../user/search-bar/search-bar.component.ts | 3 +++
2 files changed, 23 insertions(+)
diff --git
a/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.spec.ts
b/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.spec.ts
index 2540e89d2b..9256c07f2d 100644
---
a/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.spec.ts
+++
b/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.spec.ts
@@ -147,6 +147,26 @@ describe("SearchBarComponent", () => {
expect(component.listOfResult).toEqual(["hello"]);
}));
+ it("drops the previous user's cached suggestions when the user changes",
fakeAsync(() => {
+ searchSpy.search.mockReturnValue(of({ results:
[makeWorkflowItem("private-wf")], more: false } as SearchResult));
+ component.onSearchInputChange("private");
+ tick(200);
+ expect(component.listOfResult).toEqual(["private-wf"]);
+
+ isLoginValue = false;
+ userChangeSubject.next(undefined);
+ expect(component.listOfResult).toEqual([]);
+
+ searchSpy.search.mockReturnValue(of({ results: [], more: false } as
SearchResult));
+ component.onSearchInputChange("private");
+ tick(200);
+
+ // Asked the server again, as a signed-out user, instead of reusing the
cache.
+ expect(searchSpy.search).toHaveBeenCalledTimes(2);
+ expect(searchSpy.search.mock.calls[1][6]).toBe(false);
+ expect(component.listOfResult).toEqual([]);
+ }));
+
it("addToCache evicts the oldest entry once 20 queries are cached", () => {
const cache = (component as any).searchCache as Map<string, string[]>;
const order = (component as any).queryOrder as string[];
diff --git
a/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
b/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
index 638a2f7e7b..9e6a77382b 100644
---
a/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
+++
b/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
@@ -81,6 +81,9 @@ export class SearchBarComponent {
.pipe(untilDestroyed(this))
.subscribe(() => {
this.isLogin = this.userService.isLogin();
+ // Cached suggestions belong to the previous user and may name their
private resources.
+ this.searchCache.clear();
+ this.listOfResult = [];
});
this.searchSubject
.pipe(