mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 09:46:25 +02:00
- Fix timestamp conversion: String(epochMs) → new Date(epochMs).toISOString() in use-messages-sync, use-comments-sync, use-documents, use-inbox. Without this, date comparisons (isEdited, cutoff filters) would fail. - Fix updated_at: undefined → null in use-inbox to match InboxItem type - Fix ZeroProvider: skip Zero connection for unauthenticated users - Clean 30+ stale "Electric SQL" comments in backend Python code
26 lines
738 B
TypeScript
26 lines
738 B
TypeScript
"use client";
|
|
|
|
import { currentUserAtom } from "@/atoms/user/user-query.atoms";
|
|
import { queries } from "@/zero/queries";
|
|
import { schema } from "@/zero/schema";
|
|
import { ZeroProvider as ZeroReactProvider } from "@rocicorp/zero/react";
|
|
import { useAtomValue } from "jotai";
|
|
|
|
const cacheURL = process.env.NEXT_PUBLIC_ZERO_CACHE_URL || "http://localhost:4848";
|
|
|
|
export function ZeroProvider({ children }: { children: React.ReactNode }) {
|
|
const { data: user } = useAtomValue(currentUserAtom);
|
|
|
|
if (!user?.id) {
|
|
return <>{children}</>;
|
|
}
|
|
|
|
const userID = String(user.id);
|
|
const context = { userId: userID };
|
|
|
|
return (
|
|
<ZeroReactProvider {...{ userID, context, cacheURL, schema, queries }}>
|
|
{children}
|
|
</ZeroReactProvider>
|
|
);
|
|
}
|