print better errors in the search view instead of a blocking modal (#29724)

* print better errors in the search view instead of a blocking modal

* update tests and i18n

* fix unused variable

* fix unused variable again
This commit is contained in:
Julien CLEMENT
2025-04-14 15:36:34 +02:00
committed by GitHub
parent 7ce0a76414
commit 475e449e81
6 changed files with 24 additions and 22 deletions

View File

@@ -247,7 +247,7 @@ describe("<RoomSearchView/>", () => {
await screen.findByRole("progressbar");
await screen.findByText("Potato");
expect(onUpdate).toHaveBeenCalledWith(false, expect.objectContaining({}));
expect(onUpdate).toHaveBeenCalledWith(false, expect.objectContaining({}), null);
rerender(
<MatrixClientContext.Provider value={client}>
@@ -314,7 +314,8 @@ describe("<RoomSearchView/>", () => {
});
});
it("should show modal if error is encountered", async () => {
it("report error if one is encountered", async () => {
const onUpdate = jest.fn();
const deferred = defer<ISearchResults>();
render(
@@ -326,14 +327,18 @@ describe("<RoomSearchView/>", () => {
promise={deferred.promise}
resizeNotifier={resizeNotifier}
className="someClass"
onUpdate={jest.fn()}
onUpdate={onUpdate}
/>
</MatrixClientContext.Provider>,
);
deferred.reject(new Error("Some error"));
deferred.reject("Some error");
try {
// Wait for RoomSearchView to process the promise
await deferred.promise;
} catch {}
await screen.findByText("Search failed");
await screen.findByText("Some error");
expect(onUpdate).toHaveBeenCalledWith(false, null, "Some error");
expect(onUpdate).toHaveBeenCalledTimes(2);
});
it("should combine search results when the query is present in multiple sucessive messages", async () => {