diff --git a/nextjs/src/app/api/trpc/[trpc]/route.ts b/nextjs/src/app/api/trpc/[trpc]/route.ts index 90a1044..452eccf 100644 --- a/nextjs/src/app/api/trpc/[trpc]/route.ts +++ b/nextjs/src/app/api/trpc/[trpc]/route.ts @@ -4,7 +4,7 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; const handler = async (request: Request) => { - await new Promise(r => setTimeout(r, 1000)); // delay for testing + // await new Promise(r => setTimeout(r, 1000)); // delay for testing return fetchRequestHandler({ endpoint: "/api/trpc", req: request, diff --git a/nextjs/src/app/course/[courseName]/utils/useAuthoritativeUpdates.tsx b/nextjs/src/app/course/[courseName]/utils/useAuthoritativeUpdates.tsx index db6d10e..391be89 100644 --- a/nextjs/src/app/course/[courseName]/utils/useAuthoritativeUpdates.tsx +++ b/nextjs/src/app/course/[courseName]/utils/useAuthoritativeUpdates.tsx @@ -13,10 +13,11 @@ export function useAuthoritativeUpdates({ useState(serverUpdatedAt); const [updateMonacoKey, setUpdateMonacoKey] = useState(1); const clientIsAuthoritative = useMemo(() => { - const authority = serverUpdatedAt <= clientDataUpdatedAt + 500; - console.log("client is authoritative", authority); + const authority = serverUpdatedAt <= clientDataUpdatedAt; + // const authority = serverUpdatedAt <= clientDataUpdatedAt + 500; // if it is close, it might be the second-to-last update changing the first (by file update delays), add some buffer... + // console.log("client is authoritative", authority); return authority; - }, [clientDataUpdatedAt, serverUpdatedAt]); // if it is close, it might be the second-to-last update changing the first (by file update delays), add some buffer... + }, [clientDataUpdatedAt, serverUpdatedAt]); const textUpdate = useCallback((t: string, updateMonaco: boolean = false) => { setText(t);