Comments (7)
Usually, remote changes are not tracked by Y.UndoManager
.
But if you configured it to track remote changes:
Is this issue really specific to Y-CRDT as a remote client?
from yjs.
How can I configure it to track remote changes?
from yjs.
I saw the undo manager ignoreRemoteMapChanges: true
option, but it doesn't have any effect.
Basically this is what I am trying to do:
const Y = require('yjs')
const doc0 = new Y.Doc()
const doc1 = new Y.Doc()
doc0.on('update', update => {
Y.applyUpdate(doc1, update)
})
doc1.on('update', update => {
Y.applyUpdate(doc0, update)
})
const map0 = doc0.getMap('map')
const map1 = doc1.getMap('map')
const undoManager = new Y.UndoManager(map1)
map0.set('key0', 'val0')
console.log(map1.toJSON())
undoManager.undo()
console.log(map1.toJSON())
Which works fine, because it prints:
{ key0: 'val0' }
{}
The undo manager did undo the remote change.
So it seems that the issue is specific to y-crdt
as a remote client.
from yjs.
I don't think so. If you use y-websocket, you need to add the y-websocket provider instance as a tracked origin. Then it should work fine.
Yjs & Y-CRDT should always generate the same updates. Since this is a basic case, I don't expect that they generate different updates that would result in an issue.
from yjs.
If you use y-websocket, you need to add the y-websocket provider instance as a tracked origin.
Thanks, that worked. But is it documented somewhere?
from yjs.
https://docs.yjs.dev/api/undo-manager
Optionally, you may specify trackedOrigins to filter specific changes. By default, all local changes will be tracked.
I updated it to:
Optionally, you may specify trackedOrigins to track changes from different sources. By default, all local changes that don't specify an origin will be tracked.
Feel free to contribute to the docs. I think it already explains how origins can be used.
from yjs.
That part was fine, but I think there should be a mention that y-websocket
adds the WebSocket provider as an origin to the changes (that was the information I was missing).
from yjs.
Related Issues (20)
- 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
- Undo manager without origin doesn't catch updates with origin HOT 7
- How to use YJS in a server written in Java language? HOT 3
- Delta embeds support HOT 2
- Regression in v13.6.13 and up HOT 2
- Is there a way to actively trigger garbage collection or actively discard some data HOT 1
- Allow subscribing to only updates with a specific origin on doc.on('update', () => {}) HOT 2
- Inconsistency in absolute position index across clients after an undo operation HOT 5
- @kangc/v-md-editor
- UndoManager: Undoing combination of Y.Map#set and deleting that Y.Map from parent Y.Array results in 1 client with invalid Y.Map HOT 4
- yjs v13.6.13 breaks `y-utility/y-multidoc-undomanager` HOT 1
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.