Skip to content

Commit

Permalink
Update yorkie to v0.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb committed Nov 22, 2024
1 parent a79b2cc commit 2c617e5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/docker/docker-compose-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
- "yorkie:yorkie"

yorkie:
image: "yorkieteam/yorkie:0.5.5"
image: "yorkieteam/yorkie:0.5.6"
command: ["server", "--enable-pprof"]
restart: always
ports:
Expand Down
2 changes: 1 addition & 1 deletion backend/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
yorkie:
image: "yorkieteam/yorkie:0.5.5"
image: "yorkieteam/yorkie:0.5.6"
command: ["server", "--enable-pprof"]
restart: always
ports:
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"refractor": "^4.8.1",
"validator": "^13.12.0",
"vite-plugin-package-version": "^1.1.0",
"yorkie-js-sdk": "0.5.5"
"yorkie-js-sdk": "0.5.6"
},
"devDependencies": {
"@sentry/vite-plugin": "^2.20.1",
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/hooks/useYorkieDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ export const useYorkieDocument = (
if (!client || !doc) return;

try {
await client.detach(doc);
await client.deactivate();
await client.deactivate({ keepalive: true });
} catch (error) {
console.error("Error during Yorkie cleanup:", error);
}
Expand All @@ -102,8 +101,7 @@ export const useYorkieDocument = (

// Clean up if the component is unmounted before the initialization is done
if (!mounted) {
await newClient.detach(newDoc);
await newClient.deactivate();
await newClient.deactivate({ keepalive: true });
return;
}

Expand Down Expand Up @@ -137,5 +135,17 @@ export const useYorkieDocument = (
};
}, [cleanUpYorkieDocument]);

useEffect(() => {
const handleBeforeUnload = () => {
cleanUpYorkieDocument();
};

window.addEventListener("beforeunload", handleBeforeUnload);

return () => {
window.removeEventListener("beforeunload", handleBeforeUnload);
};
}, [cleanUpYorkieDocument]);

return { client, doc };
};
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2c617e5

Please sign in to comment.