calling clearUnsavedChanges() sets the arrays as empty on the user object #1038
Labels
bounty:$20
Bounty applies for fixing this issue (Parse Bounty Program)
type:bug
Impaired feature or lacking behavior that is likely assumed
New Issue Checklist
Issue Description
When I call clearUnsavedChanges() on the user object it sets the arrays as empty. After looking deeper into the issue I found out the response that is returned when you call getUpdatedUser() or query the user has savedArray as empty in the Parse Array class that is returned as part of the response but estimatedArray has all the values.
But if you call user.save() and check its response both the estimatedArray and savedArray has values.
So, when you call clearUnsavedChanges() on the returned user object through user.save() the arrays remain as it is and not set as empty.
The issue might be because of savedArray being returned as empty in the Parse Array class and when clearUnsavedChanges() is called it calls onClearUnsaved() method in Parse Array class which sets the estimatedArray = savedArray so when savedArray is empty the whole array is set as empty. I'm not sure if it's an actual issue or I'm doing something wrong.
Steps to reproduce
Just call clearUnsavedChanges() on the parse user object and print the user as string in the console and all the arrays will be empty and then query the user or call getUpdatedUser() and the savedArray will be empty for every Parse Array class that is returned as response. And then call user.save() and check its response, it will have values in both estimatedArray and savedArray and then call clearUnsavedChanges() on the returned user through response.results.first and arrays will remain as it is.
Actual Outcome
clearUnsavedChanges() sets the arrays as empty and getUpdatedUser() or query user returns savedArray as empty in Parse Array class
Expected Outcome
clearUnsavedChanges() should only clear the unsaved changes and getUpdatedUser() or query user should return values in both estimatedArray and savedArray
Environment
Flutter 3.29.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 09de023485 (3 weeks ago) • 2025-02-28 13:44:05 -0800
Engine • revision 871f65ac1b
Tools • Dart 3.7.0 • DevTools 2.42.2
Parse Flutter SDK
9.0.0
3.29.1
3.7.0
Windows 10
Server
6.2.0
Logs
The text was updated successfully, but these errors were encountered: