Do not `invert` automatically in `Doc.prototype._rollback`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 456
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
Hey ShareDB's team!
While using https://github.com/ottypes/json1 with ShareDB, I found a small problem in Doc.prototype._rollback. It automatically uses JSON1.type.invert but since we don't use invertible operations (our remove ops do not contain the removed data), it does not work.
https://github.com/share/sharedb/blob/fa9179dd565b11e129c1f005de0a7542ef352363/lib/client/doc.js#L950-L957
Moreover JSON1 support for invertible operations and composition is known to not be without flaws.
Do you think we could introduce a configuration option to deactivate this functionality?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/client/doc.js around Doc.prototype._rollback at lines 950-957 and inspect how JSON1.type.invert is invoked. Review the issue's JSON1 invertibility and composition concern before deciding where a configuration option belongs. Done means rollback can avoid automatic inversion for non-invertible operations without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100