mirror of
https://github.com/appy-one/acebase-core.git
synced 2026-05-24 22:01:23 -06:00
Do not emit error event if mutation was decided not to be rolled back by shouldRollback callback function (#52)
This commit is contained in:
parent
33ca750a1d
commit
d8bcb4e15c
1 changed files with 1 additions and 1 deletions
|
|
@ -327,7 +327,6 @@ export class LiveDataProxy {
|
|||
.context(context)
|
||||
[update.type](update.value) // .set or .update
|
||||
.catch(async (err) => {
|
||||
clientEventEmitter.emit('error', <ProxyObserveError>{ source: 'update', message: `Error processing update of "/${ref.path}"`, details: err });
|
||||
// console.warn(`Proxy could not update DB, should rollback (${update.type}) the proxy value of "${update.ref.path}" to: `, update.previous);
|
||||
if (options?.shouldRollback) {
|
||||
const rollback = await options.shouldRollback(err, { type: update.type, ref: update.ref, value: update.value, previous: update.previous });
|
||||
|
|
@ -336,6 +335,7 @@ export class LiveDataProxy {
|
|||
return;
|
||||
}
|
||||
}
|
||||
clientEventEmitter.emit('error', <ProxyObserveError>{ source: 'update', message: `Error processing update of "/${ref.path}"`, details: err });
|
||||
const context:IProxyContext = { acebase_proxy: { id: proxyId, source: 'update-rollback' } };
|
||||
const mutations:IDataMutationsArray = [];
|
||||
if (update.type === 'set') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue