Skip to content

transformPresence is not a function #423

Description

@danijar

We're using ShareDB with the nickasd/sharedb-codemirror connector. The editor content is synchronized well and now we want to show other editor's cursors via ShareDB's presence feature.

Creating the doc on the server:

var doc = conn.get('docs', uuid.v4())
doc.create({content: '', metaData: {...}}, null, {}, err => {})

Connecting to the doc from the client:

var doc = conn.get('collection', doc_id)
doc.fetch(callback)
var presence = conn.getDocPresence('collection', doc.id)
var localPresence = presence.create(new ObjectID().toString())

Error message on document edit:

bundle.js:25816 Uncaught TypeError: Cannot read property 'content' of undefined
    at ShareDBCodeMirror.assertValue (bundle.js:25816)
    at ShareDBCodeMirror.afterLocalChanges (bundle.js:25925)
    at ShareDBCodeMirror.codeMirrorChanges (bundle.js:25728)
    at signal (bundle.js:12762)
    at endOperation_finish (bundle.js:16102)
    at endOperations (bundle.js:16003)
    at bundle.js:15986
    at finishOperation (bundle.js:14244)
    at endOperation (bundle.js:15983)
    at runInOp (bundle.js:16112)
assertValue @ bundle.js:25816
afterLocalChanges @ bundle.js:25925
ShareDBCodeMirror.codeMirrorChanges @ bundle.js:25728
signal @ bundle.js:12762
endOperation_finish @ bundle.js:16102
endOperations @ bundle.js:16003
(anonymous) @ bundle.js:15986
finishOperation @ bundle.js:14244
endOperation @ bundle.js:15983
runInOp @ bundle.js:16112
TextareaInput.poll @ bundle.js:21717
(anonymous) @ bundle.js:21502
bundle.js:25717 TypeError: this._doc.type.transformPresence is not a function
    at LocalDocPresence._transformAgainstOp (bundle.js:27856)
    at emitThree (bundle.js:23452)
    at Doc.emit (bundle.js:23511)
    at Doc._otApply (bundle.js:27357)
    at Doc._submit (bundle.js:27461)
    at Doc.submitOp (bundle.js:27562)
    at ShareDBCodeMirror.afterLocalChanges (bundle.js:25919)
    at ShareDBCodeMirror.codeMirrorChanges (bundle.js:25728)
    at signal (bundle.js:12762)
    at endOperation_finish (bundle.js:16102)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions