mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-05 12:09:09 +00:00
Fixed erroneous 'use server' in ui component
This commit is contained in:
parent
a9ad7bcb2c
commit
2a47299cd0
1 changed files with 12 additions and 5 deletions
|
@ -1,14 +1,14 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { cookies } from "next/headers";
|
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
import { useState } from "react";
|
||||||
import { DashboardBreadcrumb } from "@/components/dashboard-breadcrumb";
|
import { DashboardBreadcrumb } from "@/components/dashboard-breadcrumb";
|
||||||
import { AppSidebarProvider } from "@/components/sidebar/AppSidebarProvider";
|
import { AppSidebarProvider } from "@/components/sidebar/AppSidebarProvider";
|
||||||
import { ThemeTogglerComponent } from "@/components/theme/theme-toggle";
|
import { ThemeTogglerComponent } from "@/components/theme/theme-toggle";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
|
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
|
||||||
|
|
||||||
export async function DashboardClientLayout({
|
export function DashboardClientLayout({
|
||||||
children,
|
children,
|
||||||
searchSpaceId,
|
searchSpaceId,
|
||||||
navSecondary,
|
navSecondary,
|
||||||
|
@ -19,11 +19,18 @@ export async function DashboardClientLayout({
|
||||||
navSecondary: any[];
|
navSecondary: any[];
|
||||||
navMain: any[];
|
navMain: any[];
|
||||||
}) {
|
}) {
|
||||||
const cookieStore = await cookies();
|
const [open, setOpen] = useState<boolean>(() => {
|
||||||
const defaultOpen = cookieStore.get("sidebar_state")?.value === "true";
|
try {
|
||||||
|
const match = document.cookie.match(/(?:^|; )sidebar_state=([^;]+)/);
|
||||||
|
if (match) return match[1] === "true";
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarProvider defaultOpen={defaultOpen}>
|
<SidebarProvider open={open} onOpenChange={setOpen}>
|
||||||
{/* Use AppSidebarProvider which fetches user, search space, and recent chats */}
|
{/* Use AppSidebarProvider which fetches user, search space, and recent chats */}
|
||||||
<AppSidebarProvider
|
<AppSidebarProvider
|
||||||
searchSpaceId={searchSpaceId}
|
searchSpaceId={searchSpaceId}
|
||||||
|
|
Loading…
Add table
Reference in a new issue