cleaning up for prod

This commit is contained in:
2024-11-19 09:06:41 -07:00
parent 5f6e7718bd
commit d02d6d8b7b
2 changed files with 5 additions and 4 deletions

View File

@@ -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,

View File

@@ -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);