Skip to content

how to reload/refresh ShareDB document?  #650

Description

@icoco

as topic, a document was created as follow code :

const shareDBDoc = this.shareDBConnection.get('documents', key ); 
...
shareDBDoc.create(initialDocument, json1Presence.type.uri);

since the document does not reload file from disk realtime, have to reload/refresh document manually,

I use ' shareDBDoc.destory() ', it does not work, report error bellow:

ShareDBError: Document already exists

my questions, how to reload or refresh the shareDBDoc ? can not find relative guide from the online document yet..

thank for help in advance

Activity

  1. icoco commented on May 8, 2024

    @icoco
    Author

    ah, I use del method , it seem works but not sure if is best way

  2. alecgibson commented on May 8, 2024

    @alecgibson
    Collaborator

    You want doc.subscribe() for live updates.

  3. icoco commented on May 8, 2024

    @icoco
    Author

    You want doc.subscribe() for live updates.

    many thanks for guide, where can find relative example ? it seem not work if the disk or file was changed by outside

  4. alecgibson commented on May 8, 2024

    @alecgibson
    Collaborator
  5. Qquanwei commented on May 9, 2024

    @Qquanwei

    You want doc.subscribe() for live updates.

    many thanks for guide, where can find relative example ? it seem not work if the disk or file was changed by outside

    sharedb couldn't detect change by outside, the only way is using submitOp submit a operation,

  6. icoco commented on May 11, 2024

    @icoco
    Author

    use 'submitOp' save local change to server ?

    question is , if the document was change by other Editor or user create a new folder on server, what method can sync / refresh ? I found seem no way to sync the change , a little confuse , maybe I have not read the document more carefully

  7. curran commented on Jan 21, 2025

    @curran
    Contributor

    If you're interfacing with the actual file system, that's outside the scope of ShareDB itself, but you can use something like chokidar to listen for changes to the file system, compute diffs maybe using json0-ot-diff, then submit the resulting ops. I'm looking to do the same thing actually in VZCode: Watch File System.

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