π OpenHands: AI-Driven Development
fix(frontend): Reduce delta calculating message rate and fix modal import (#5387)
sp.wack43e074c3ed36
diff --git a/frontend/__tests__/hooks/use-rate.test.ts b/frontend/__tests__/hooks/use-rate.test.tsindex bc3c03f019..cade3e6554 100644--- a/frontend/__tests__/hooks/use-rate.test.ts+++ b/frontend/__tests__/hooks/use-rate.test.ts@@ -1,6 +1,6 @@import { act, renderHook } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { useRate } from "#/utils/use-rate";+import { useRate } from "#/hooks/use-rate";describe("useRate", () => {beforeEach(() => {diff --git a/frontend/src/components/features/waitlist/waitlist-modal.tsx b/frontend/src/components/features/waitlist/waitlist-modal.tsxindex c8ee583fbe..ba221da68a 100644--- a/frontend/src/components/features/waitlist/waitlist-modal.tsx+++ b/frontend/src/components/features/waitlist/waitlist-modal.tsx@@ -1,10 +1,10 @@-import { ModalBody } from "@nextui-org/react";import GitHubLogo from "#/assets/branding/github-logo.svg?react";import AllHandsLogo from "#/assets/branding/all-hands-logo.svg?react";import { JoinWaitlistAnchor } from "./join-waitlist-anchor";import { WaitlistMessage } from "./waitlist-message";import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";import { ModalButton } from "#/components/shared/buttons/modal-button";+import { ModalBody } from "#/components/shared/modals/modal-body";interface WaitlistModalProps {ghToken: string | null;diff --git a/frontend/src/context/ws-client-provider.tsx b/frontend/src/context/ws-client-provider.tsxindex 89483b234a..fcbc435616 100644--- a/frontend/src/context/ws-client-provider.tsx+++ b/frontend/src/context/ws-client-provider.tsx@@ -6,7 +6,7 @@ import ActionType from "#/types/action-type";import EventLogger from "#/utils/event-logger";import AgentState from "#/types/agent-state";import { handleAssistantMessage } from "#/services/actions";-import { useRate } from "#/utils/use-rate";+import { useRate } from "#/hooks/use-rate";const isOpenHandsMessage = (event: Record<string, unknown>) =>event.action === "message";@@ -58,7 +58,7 @@ export function WsClientProvider({const [events, setEvents] = React.useState<Record<string, unknown>[]>([]);const lastEventRef = React.useRef<Record<string, unknown> | null>(null);- const messageRateHandler = useRate({ threshold: 500 });+ const messageRateHandler = useRate({ threshold: 250 });function send(event: Record<string, unknown>) {if (!sioRef.current) {diff --git a/frontend/src/utils/use-effect-once.ts b/frontend/src/hooks/use-effect-once.tssimilarity index 100%rename from frontend/src/utils/use-effect-once.tsrename to frontend/src/hooks/use-effect-once.tsdiff --git a/frontend/src/utils/use-rate.ts b/frontend/src/hooks/use-rate.tssimilarity index 100%rename from frontend/src/utils/use-rate.tsrename to frontend/src/hooks/use-rate.tsdiff --git a/frontend/src/routes/_oh.app/route.tsx b/frontend/src/routes/_oh.app/route.tsxindex 666fa3c132..776d53373c 100644--- a/frontend/src/routes/_oh.app/route.tsx+++ b/frontend/src/routes/_oh.app/route.tsx@@ -6,7 +6,7 @@ import { Controls } from "#/components/features/controls/controls";import { RootState } from "#/store";import { clearMessages } from "#/state/chat-slice";import { clearTerminal } from "#/state/command-slice";-import { useEffectOnce } from "#/utils/use-effect-once";+import { useEffectOnce } from "#/hooks/use-effect-once";import CodeIcon from "#/icons/code.svg?react";import GlobeIcon from "#/icons/globe.svg?react";import ListIcon from "#/icons/list-type-number.svg?react";