Skip to content

Commit

Permalink
Bump up Yorkie to v0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Oct 22, 2024
1 parent cf4e84a commit 1cb204e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 72 deletions.
115 changes: 58 additions & 57 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"remark-toc": "^8.0.1",
"tss-react": "^4.8.2",
"unique-names-generator": "^4.7.1",
"yorkie-js-sdk": "^0.4.13"
"yorkie-js-sdk": "^0.5.2"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
Expand Down
18 changes: 4 additions & 14 deletions src/components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { makeStyles } from 'styles/common';
import { Presence, syncPeer } from 'features/peerSlices';
import { Alert, Box, CircularProgress, Snackbar } from '@mui/material';
import { StreamConnectionStatus } from 'yorkie-js-sdk';
import WhiteBoardEditor from './mime/application/whiteboard/Editor';
import Editor from './mime/text/md/Editor';

Expand Down Expand Up @@ -84,21 +85,10 @@ export default function BaseEditor(props: { docKey: string }) {
return;
}

const unsubscribeClient = client.subscribe((event) => {
if (
status === DocStatus.Connect &&
((event.type === 'status-changed' && event.value === 'deactivated') ||
(event.type === 'stream-connection-status-changed' && event.value === 'disconnected') ||
(event.type === 'document-synced' && event.value === 'sync-failed'))
) {
const unsubscribeClient = doc.subscribe('connection', (event) => {
if (status === DocStatus.Connect && event.value === StreamConnectionStatus.Disconnected) {
dispatch(setStatus(DocStatus.Disconnect));
} else if (
status === DocStatus.Disconnect &&
(event.type === 'document-changed' ||
(event.type === 'status-changed' && event.value === 'activated') ||
(event.type === 'stream-connection-status-changed' && event.value === 'connected') ||
(event.type === 'document-synced' && event.value === 'synced'))
) {
} else if (status === DocStatus.Disconnect && event.value === StreamConnectionStatus.Connected) {
dispatch(setStatus(DocStatus.Connect));
}
});
Expand Down

0 comments on commit 1cb204e

Please sign in to comment.