Skip to content

Commit ff0249f

Browse files
committed
fix: pass file id for direct editing and fail y.js provider setup if none was passed
Signed-off-by: Julius Härtl <[email protected]>
1 parent bb7ff0a commit ff0249f

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/services/SyncServiceProvider.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ import { logger } from '../helpers/logger.js'
3333
* @param {object} options.initialSession - initialSession to start from
3434
*/
3535
export default function createSyncServiceProvider({ ydoc, syncService, fileId, initialSession }) {
36+
if (!fileId) {
37+
throw new Error('fileId is required')
38+
}
3639
const WebSocketPolyfill = initWebSocketPolyfill(syncService, fileId, initialSession)
3740
const websocketProvider = new WebsocketProvider(
3841
'ws://localhost:1234',

src/views/DirectEditing.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<div id="direct-editor" :class="{'icon-loading': saving}">
2525
<Editor ref="editor"
2626
:initial-session="initialSession"
27+
:file-id="initial.fileId"
2728
:active="true"
2829
:mime="initial.mimetype"
2930
:is-direct-editing="true"

0 commit comments

Comments
 (0)