You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐛 Unhandled rejection when submitting ops during hard rollback. (#692)
* 🐛 Unhandled rejection when submitting ops during hard rollback.
After doing the steps:
1. Create a doc with rich text type (or any other non irreversible type)
2. Make op submission fail
3. Now in the hard rollback we do `this._setType(null);`
4. If there is any op comming before the hard rollback `fetch` is finished, we get the error
```
Cannot submit op. Document has not been created.
```
as in the `_submit` we do:
```typescript
if (!this.type) {
var err = new ShareDBError(
ERROR_CODE.ERR_DOC_DOES_NOT_EXIST,
'Cannot submit op. Document has not been created. ' + this.collection + '.' + this.id
);
if (callback) return callback(err);
return this.emit('error', err);
}
```
We definitely do not handle this case properly. Possible solutions:
1. Just throw error whenever that happens, which is easy to implement
and it is not really breaking. User would be then able to react on
the error or just ignore it.
2. Store copy of cannonical snapshot in the doc itself, so that we do
not have to do fetch for hard rollback. More difficult to implement
and has a side effect of storing the doc twice in the memory.
* Update to call _isInHArdRollback at the top of fetch
0 commit comments