progress / JSDO

Client side TypeScript library to access Progress® Data Object Services
Other
23 stars 27 forks source link

Issue with getErrors using mergeMode: progress.data.JSDO.MODE_MERGE #273

Open W1nstar opened 4 years ago

W1nstar commented 4 years ago

Hello,

I've set up my app to use mergeMode: progress.data.JSDO.MODE_MERGE on read operations so I can deploy a successful pagination system.

It's been working great, but whenever there's an an unsuccessful validation on an update operation, the first time jsdo.getErrors() always returns undefined as error message. The response found inside the request is correctly giving the error, and there's nothing wrong that I've been able to find in the backend.

Also, this doesn't happen without the mergeMode enabled on read operations. I've been trying to track the error throughout the JSDO but it's proven too difficult without full knowledge of it.

What I was able to find is that the _undoUpdate function is called, and is copying a record with _errorString property set to null over a record with the correct _errorString property, wich is then returned. When the assign function is called, even previous to it's first line of code (this._saveBeforeImageUpdate()) or communicating to the server, this.data already has a copy of every record read and stored from the read operation, with an _errorString property set to undefined. I haven't been able to find why or how is this undefined _errorString property on the data collection already.

Second time the assign is called, different methods are called and I lose the thread.

edselg commented 4 years ago

@W1nstar

Thank you for reporting this issue.

Would it be possible for you to provide a reproducible case?

The intention of the undoUpdate() function is to revert the changes performed by an update when an error occurs. The getErrors() function should keep the info on the errors even after a rollback.

Thank you.

W1nstar commented 4 years ago

I can try if there is any open catalog out there. Only one I have is work related and I can't publish it. Do you know of any demo catalog or something similar I could use?

edselg commented 4 years ago

@W1nstar

Here is a catalog and service that you can use to reproduce the issue:

Please give it a try.

Thanks.