Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bunch of cleanups backported from my durable objects prototype #56

Merged
merged 8 commits into from
Oct 11, 2021
7 changes: 7 additions & 0 deletions pages/d/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Nav } from "../../frontend/nav";
import Pusher from "pusher-js";
import { M, mutators } from "../../frontend/mutators";
import { randUserInfo } from "../../frontend/client-state";
import { randomShape } from "../../frontend/shape";

export default function Home() {
const [rep, setRep] = useState<Replicache<M> | null>(null);
Expand All @@ -30,6 +31,12 @@ export default function Home() {
id: await r.clientID,
defaultUserInfo,
});
r.onSync = (syncing: boolean) => {
if (!syncing) {
r.onSync = null;
r.mutate.initShapes(new Array(5).fill(null).map(() => randomShape()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer Array.from({length: 5}, () => randomShape()) but who cares?

}
};

Pusher.logToConsole = true;
var pusher = new Pusher("d9088b47d2371d532c4c", {
Expand Down