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.3/pr-9229-79dcb0eb89a8618d50a8f73ae4c9567095dea041
in repository https://gitbox.apache.org/repos/asf/texera.git
commit 46fbcb4393f6de2b6322f3e5e9f905872cf3ba55
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 4 01:47:27 2026 +0000
fix(frontend, v1.3): clear the search bar’s suggestions when the user
changes (#9229)
### What changes were proposed in this PR?
Automated backport of #9090 to `release/v1.3`.
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: mengw15 <[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 5160af331f..884d4e6c84 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
@@ -145,6 +145,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[]>;
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 9238731060..20078660ea 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
@@ -79,6 +79,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(