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

Can't change attached document maintaining client #939

Open
green-kong opened this issue Jan 25, 2025 · 0 comments
Open

Can't change attached document maintaining client #939

green-kong opened this issue Jan 25, 2025 · 0 comments
Labels
bug 🐞 Something isn't working

Comments

@green-kong
Copy link

green-kong commented Jan 25, 2025

What happened:

First of all, I really appreciate about this beautiful opensource.

I'm making something using yorkie.
That is what i want.
Maintaining client, change attached document.
For this, I need to generate client and document first.
And attach document of course.
If i wanna change document, I detach a document which I attached right before.
Lastly, I generate new document, and try to attach document.
But have a problem to do this.

What you expected to happen:
Maintaining client, change attached document.

How to reproduce it (as minimally and precisely as possible):
You can check a problem with this code.

import yorkie from 'yorkie-js-sdk';

async function main() {
  const client = new yorkie.Client('https://api.yorkie.dev', {
    apiKey,
  });
  await client.activate();

  const doc = new yorkie.Document('my-first-document');
  const doc2 = new yorkie.Document('my-first-document2');

  // first doc attach
  await client.attach(doc);
  console.log('attach doc1');
  await client.detach(doc);
  console.log('detach doc1');

  // second doc attach
  await client.attach(doc2);
  console.log('attach doc2');
  await client.detach(doc2);
  console.log('detach doc2');

  // again first doc attach
  await client.attach(doc);
  console.log('attach doc1');
}
main();

Anything else we need to know?:

Environment:

  • Operating system:
  • Browser and version:
  • Yorkie version (use yorkie version):
  • Yorkie JS SDK version:
@krapie krapie added the bug 🐞 Something isn't working label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants