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 d1ba35e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 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
17 changes: 14 additions & 3 deletions frontend/src/hooks/useYorkieDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const useYorkieDocument = (

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 +102,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 +136,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 d1ba35e

Please sign in to comment.