Skip to content

calling clearUnsavedChanges() sets the arrays as empty on the user object #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
nabos440 opened this issue Mar 20, 2025 · 1 comment · May be fixed by #1039
Open
4 tasks done

calling clearUnsavedChanges() sets the arrays as empty on the user object #1038

nabos440 opened this issue Mar 20, 2025 · 1 comment · May be fixed by #1039
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@nabos440
Copy link

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

  • SDK version: 9.0.0
  • Flutter version: 3.29.1
  • Dart version: 3.7.0
  • Operating system version: Windows 10

Server

  • Parse Server version: 6.2.0

Logs

Copy link

🚀 Thanks for opening this issue!

ℹ️ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added type:bug Impaired feature or lacking behavior that is likely assumed bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants