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

Root shared objects have AbstractType type on the server #853

Closed
andevdokimov opened this issue Sep 6, 2024 · 2 comments
Closed

Root shared objects have AbstractType type on the server #853

andevdokimov opened this issue Sep 6, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@andevdokimov
Copy link

Description
Shared objects inside the yDoc.shared have AbstractType and it does seem impossible to figure out the exact type (YMap/YArray etc).

Steps to reproduce the bug

Say, on client side I have yDoc. Then I create two shared root objects:
const yMap = yDoc.getMap('testMap');
// fill yMap with some data
const yArray = yDoc.getArray('testArray');
// fill yArray with some data

Then when you inspect dDoc.share on the server side, this map will have two items of AbstractType type

Is this kind of expected or bug?
If this is expected, then how to understand the particular type of the root objects?

Thanks.

@andevdokimov andevdokimov added the bug Something isn't working label Sep 6, 2024
@ilya2204
Copy link

As far as I know, this is the behavior of yjs. Until someone explicitly calls getMap/getArray in the document, the document will not contain information about a specific type.

@janthurau
Copy link
Collaborator

yes! that's expected behaviour of yjs. this might help: https://discuss.yjs.dev/t/getting-the-ytype-of-any-yobject/187

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

3 participants