Skip to content

Commit

Permalink
fix: move ConversationProvider to root component
Browse files Browse the repository at this point in the history
- Move ConversationProvider to root component to fix useConversation hook
- Remove ConversationProvider from App component
- Fix TypeScript errors in build
  • Loading branch information
openhands-agent committed Dec 9, 2024
1 parent d6940f7 commit 0ddff4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 3 additions & 5 deletions frontend/src/routes/_oh.app/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { useUserPrefs } from "#/context/user-prefs-context";
import { useConversationConfig } from "#/hooks/query/use-conversation-config";
import { Container } from "#/components/layout/container";
import Security from "#/components/shared/modals/security/security";
import { ConversationProvider } from "#/context/conversation-context";
import { useConversation } from "#/context/conversation-context";

function App() {
const { token, gitHubToken } = useAuth();
Expand Down Expand Up @@ -70,9 +70,8 @@ function App() {
settings={settings}
conversationId={conversationId}
>
<ConversationProvider>
<EventHandler>
<div className="flex flex-col h-full gap-3">
<EventHandler>
<div className="flex flex-col h-full gap-3">
<div className="flex h-full overflow-auto gap-3">
<Container className="w-[390px] max-h-full relative">
<ChatInterface />
Expand Down Expand Up @@ -120,7 +119,6 @@ function App() {
/>
</div>
</EventHandler>
</ConversationProvider>
</WsClientProvider>
);
}
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/routes/_oh/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useConfig } from "#/hooks/query/use-config";
import { Sidebar } from "#/components/features/sidebar/sidebar";
import { WaitlistModal } from "#/components/features/waitlist/waitlist-modal";
import { AnalyticsConsentFormModal } from "#/components/features/analytics/analytics-consent-form-modal";
import { ConversationProvider } from "#/context/conversation-context";

export function ErrorBoundary() {
const error = useRouteError();
Expand Down Expand Up @@ -77,10 +78,11 @@ export default function MainApp() {
!isFetchingAuth && !isAuthed && config.data?.APP_MODE === "saas";

return (
<div
data-testid="root-layout"
className="bg-root-primary p-3 h-screen min-w-[1024px] overflow-x-hidden flex gap-3"
>
<ConversationProvider>
<div
data-testid="root-layout"
className="bg-root-primary p-3 h-screen min-w-[1024px] overflow-x-hidden flex gap-3"
>
<Sidebar />

<div className="h-full w-full relative">
Expand All @@ -97,5 +99,6 @@ export default function MainApp() {
/>
)}
</div>
</ConversationProvider>
);
}

0 comments on commit 0ddff4d

Please sign in to comment.