Comments (2)
The top-level types are not defined globally - every client must define them for themselves. The idea is that one client could have another "view" on the data than another client. E.g. it is possible to do ydoc.get('document', Y.XmlFragment)
(read the document as a XML data type), and another client could do ydoc.get('document', Y.Array)
(read the document as an Array data structure). In the future, there might be other data types that you can use to interpret the shared data. However, I don't really recommend doing this in your case..
Another reason for not sharing type definitions globally is that it's impractical to share the type definitions of the root data types. In case the definitions mismatch (user1: ydoc.get('document', Y.Array)
, but user2: ydoc.get('document', Y.XmlFragment)
) would have to throw an exception if we enforce everyone to use the same types. Hence, we can as well allow it, as it is technically possible.
TLDR: My recommendation is to always specify what you are expecting. Don't do ydoc.get('doc')
, do ydoc.get('doc', Y.Array)
instead. Your application should know what it expects.
from yjs.
I'm a little confused because this feature(I think it's not a bug because you mentioned it before) could cause our event listener to treat the type incorrectly
See: toeverything/blocksuite#4295
from yjs.
Related Issues (20)
- Is it possible to read uintarray update data? HOT 1
- Misordered updates result in temporarily missing Y.Map keys HOT 5
- Merge transactions in undo manager HOT 7
- Mistake in documentation? Property 'set' does not exist on type 'YArray<unknown>'
- Logo as SVG? HOT 4
- RangeError Invalid typed array length: 110 & TypeError: contentRefs[(info & binary.BITS5)] is not a function HOT 2
- Support for TypeScript NodeNext HOT 4
- Inconsistent Y.XmlText.format behavior HOT 1
- support double linked list as a shared data type HOT 1
- Ace binding HOT 1
- y-loopback HOT 2
- UndoManager doesn't persist meta HOT 4
- Froala Editor support HOT 1
- UndoManager stack cleared after a removal on remote side HOT 1
- docs: duplicate Y.Event page entry HOT 1
- Ability to reference UndoManager StackItem inside Type observers
- yText delta attributes is not correct when undo
- Support build for nuxt 2 HOT 1
- Impossible to save a Y.Map when deleted from a Y.Array HOT 5
- Global document undo manager HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yjs.