Skip to content

Commit

Permalink
Bump up Yorkie to v0.5.3 (#293)
Browse files Browse the repository at this point in the history
* Bump up Yorkie to v0.5.2

* Bump up Yorkie to v0.5.3
  • Loading branch information
hackerwins authored Oct 23, 2024
1 parent cf4e84a commit fc11c70
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 74 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.3"
},
"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
4 changes: 2 additions & 2 deletions src/components/Editor/mime/text/md/CodeEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import React, { useEffect, useMemo, useRef, useCallback, useState, MouseEvent } from 'react';
import { createRoot } from 'react-dom/client';
import { useDispatch, useSelector } from 'react-redux';
import { ActorID, DocEvent, OperationInfo } from 'yorkie-js-sdk';
import { ActorID, OperationInfo } from 'yorkie-js-sdk';
import CodeMirror from 'codemirror';
import SimpleMDE from 'easymde';
import SimpleMDEReact from 'react-simplemde-editor';
Expand Down Expand Up @@ -690,7 +690,7 @@ export default function CodeEditor() {
}
};

doc.subscribe((event: DocEvent) => {
doc.subscribe((event) => {
if (event.type === 'snapshot') {
// re-sync for the new text from the snapshot
setText();
Expand Down
1 change: 1 addition & 0 deletions src/features/peerSlices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface Presence {
board: string;
whiteboardUser?: TDUser;
selection: any; // TODO(chacha912): Import type from yorkie-js-sdk
[key: string]: any; // NOTE(hackerwins): Quick fix for Indexable.
}

export enum ConnectionStatus {
Expand Down

0 comments on commit fc11c70

Please sign in to comment.