Skip to content

Commit

Permalink
fix(caps): allow the user to dismiss the error when fetching caps
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcMcIntosh committed Mar 7, 2024
1 parent 02b2541 commit 7942a75
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/hooks/useEventBusForChat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useReducer, useCallback } from "react";
import { useEffect, useReducer, useCallback, useMemo } from "react";
import {
ChatContextFile,
// ChatContextFileMessage,
Expand Down Expand Up @@ -411,7 +411,7 @@ const initialState = createInitialState();
// Maybe use context to avoid prop drilling?
export const useEventBusForChat = () => {
const [state, dispatch] = useReducer(reducer, initialState);
const postMessage = usePostMessage();
const postMessage = useMemo(usePostMessage, []);

useEffect(() => {

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should send and receive messages from the window". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should send and receive messages from the window". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should send and receive messages from the window". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "can restore a chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "can restore a chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "can restore a chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "when creating a new chat I can select which model to use". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "when creating a new chat I can select which model to use". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "when creating a new chat I can select which model to use". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (lts/*)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "retry chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should send and receive messages from the window". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should send and receive messages from the window". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should send and receive messages from the window". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "can restore a chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "can restore a chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "can restore a chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "when creating a new chat I can select which model to use". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "when creating a new chat I can select which model to use". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "when creating a new chat I can select which model to use". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 416 in src/hooks/useEventBusForChat.ts

View workflow job for this annotation

GitHub Actions / build (latest)

Unhandled error

TypeError: Cannot read properties of undefined (reading 'length') ❯ areHookInputsEqual node_modules/react-dom/cjs/react-dom.development.js:16249:38 ❯ updateEffectImpl node_modules/react-dom/cjs/react-dom.development.js:17078:11 ❯ updateEffect node_modules/react-dom/cjs/react-dom.development.js:17098:10 ❯ Object.useEffect node_modules/react-dom/cjs/react-dom.development.js:17862:14 ❯ Proxy.useEffect node_modules/react/cjs/react.development.js:1634:21 ❯ Module.useEventBusForChat src/hooks/useEventBusForChat.ts:416:3 ❯ Chat src/features/Chat.tsx:37:7 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ updateFunctionComponent node_modules/react-dom/cjs/react-dom.development.js:19588:20 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21601:16 This error originated in "src/features/Chat.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "retry chat". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
const listener = (event: MessageEvent) => {
Expand Down Expand Up @@ -455,10 +455,7 @@ export const useEventBusForChat = () => {
messages: ChatMessages,
attach_file = state.active_file.attach,
) {
dispatch({
type: EVENT_NAMES_TO_CHAT.CLEAR_ERROR,
payload: { id: state.chat.id },
});
clearError();
dispatch({
type: EVENT_NAMES_TO_CHAT.SET_DISABLE_CHAT,
payload: { id: state.chat.id, disable: true },
Expand Down Expand Up @@ -487,25 +484,30 @@ export const useEventBusForChat = () => {
});
}

useEffect(() => {
function requestCaps() {
postMessage({
type: EVENT_NAMES_FROM_CHAT.REQUEST_CAPS,
payload: {
id: state.chat.id,
},
});
}
const requestCaps = useCallback(() => {
postMessage({
type: EVENT_NAMES_FROM_CHAT.REQUEST_CAPS,
payload: {
id: state.chat.id,
},
});
}, [postMessage, state.chat.id]);

useEffect(() => {
if (
state.chat.messages.length === 0 &&
state.caps.available_caps.length === 0 &&
!state.caps.fetching &&
!state.error
!state.caps.fetching
) {
requestCaps();
}
}, [state, postMessage]);
}, [
state.chat.messages.length,
state.caps.available_caps.length,
state.caps.fetching,
state.chat.id,
requestCaps,
]);

function clearError() {
dispatch({
Expand Down Expand Up @@ -541,6 +543,7 @@ export const useEventBusForChat = () => {
);

function backFromChat() {
clearError();
postMessage({
type: EVENT_NAMES_FROM_CHAT.BACK_FROM_CHAT,
payload: { id: state.chat.id },
Expand Down Expand Up @@ -661,5 +664,6 @@ export const useEventBusForChat = () => {
setSelectedCommand,
removePreviewFileByName,
retryQuestion,
requestCaps,
};
};

0 comments on commit 7942a75

Please sign in to comment.