mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 17:43:03 +03:00
3ba2c92b50
* refactor(MultipleBrain): separate providing and data fetching * refactor(MultipleBrain): update useBrainApi * feat(MultipleBrains): remove unnecessary data fetchings * test(useBrainApi): update unit tests
28 lines
777 B
TypeScript
28 lines
777 B
TypeScript
"use client";
|
|
|
|
import { PropsWithChildren, useEffect } from "react";
|
|
|
|
import Footer from "@/lib/components/Footer";
|
|
import { NavBar } from "@/lib/components/NavBar";
|
|
import { TrackingWrapper } from "@/lib/components/TrackingWrapper";
|
|
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
|
|
|
// This wrapper is used to make effect calls at a high level in app rendering.
|
|
export const App = ({ children }: PropsWithChildren): JSX.Element => {
|
|
const { fetchAllBrains, fetchAndSetActiveBrain } = useBrainContext();
|
|
|
|
useEffect(() => {
|
|
void fetchAllBrains();
|
|
void fetchAndSetActiveBrain();
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
<TrackingWrapper />
|
|
<NavBar />
|
|
<div className="flex-1">{children}</div>
|
|
<Footer />
|
|
</>
|
|
);
|
|
};
|