mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -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) => {
|
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({
|
return fetchRequestHandler({
|
||||||
endpoint: "/api/trpc",
|
endpoint: "/api/trpc",
|
||||||
req: request,
|
req: request,
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ export function useAuthoritativeUpdates({
|
|||||||
useState(serverUpdatedAt);
|
useState(serverUpdatedAt);
|
||||||
const [updateMonacoKey, setUpdateMonacoKey] = useState(1);
|
const [updateMonacoKey, setUpdateMonacoKey] = useState(1);
|
||||||
const clientIsAuthoritative = useMemo(() => {
|
const clientIsAuthoritative = useMemo(() => {
|
||||||
const authority = serverUpdatedAt <= clientDataUpdatedAt + 500;
|
const authority = serverUpdatedAt <= clientDataUpdatedAt;
|
||||||
console.log("client is authoritative", authority);
|
// 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;
|
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) => {
|
const textUpdate = useCallback((t: string, updateMonaco: boolean = false) => {
|
||||||
setText(t);
|
setText(t);
|
||||||
|
|||||||
Reference in New Issue
Block a user