Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): thread error banner dismiss survives reconnect and rerenders #6123

Mergedmyacoub91(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/6123/headmerged by maria-rcks View on GitHub

Showing 3 changed files with 127 additions and 5 deletions.

x
0 of 3 viewed, 3 left
66 additions and 1 deletionapps/web/src/components/chat/ThreadErrorBanner.test.tsxModified
View file
@@ -1,9 +1,74 @@
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vite-plus/test";
​
-import { ThreadErrorBanner } from "./ThreadErrorBanner";
+import {
+ dismissThreadErrorBannerForSession,
+ getThreadErrorBannerKey,
+ isThreadErrorBannerDismissedForSession,
+ shouldShowThreadErrorBanner,
+ ThreadErrorBanner,
+} from "./ThreadErrorBanner";
​
describe("ThreadErrorBanner", () => {
+ it("stays hidden after its current error is dismissed", () => {
+ const bannerKey = getThreadErrorBannerKey("env:thread-a", "Aborted");
+ dismissThreadErrorBannerForSession(bannerKey);
+​
+ expect(
+ shouldShowThreadErrorBanner(
+ "env:thread-a",
+ "Aborted",
+ isThreadErrorBannerDismissedForSession(bannerKey),
+ ),
+ ).toBe(false);
+ });
+​
+ it("reappears when a new error arrives on the same thread", () => {
+ dismissThreadErrorBannerForSession(getThreadErrorBannerKey("env:thread-b", "Turn failed"));
+ const newErrorKey = getThreadErrorBannerKey("env:thread-b", "Provider crashed");
+​