Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to reload/refresh ShareDB document? #650

Open
icoco opened this issue May 8, 2024 · 6 comments
Open

how to reload/refresh ShareDB document? #650

icoco opened this issue May 8, 2024 · 6 comments

Comments

@icoco
Copy link

icoco commented May 8, 2024

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

@icoco
Copy link
Author

icoco commented May 8, 2024

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

@alecgibson
Copy link
Collaborator

You want doc.subscribe() for live updates.

@icoco
Copy link
Author

icoco commented May 8, 2024

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

@alecgibson
Copy link
Collaborator

@Qquanwei
Copy link

Qquanwei commented May 9, 2024

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,

@icoco
Copy link
Author

icoco commented May 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants