I have this layout component:
export default async function RootLayout({ children }: RootLayoutProps) {
const { spaces } = await getSpaces();
If something changes in my Layout for example if I open a menu or something it keeps trying to fetch the data and the loading component appears, is there a way to improve this or am I doing something wrong?
getSpaces
Does following:
export const getSpaces = async () => {
const { session } = await getUserAuth();
const s = await db.select().from(spaces).where(eq(spaces.userId, session?.user.id!));
return { spaces: s };
};