mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 15:18:32 -06:00
cleaning up for prod
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user