Skip to content

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

Open
@nabos440

Description

@nabos440

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$20Bounty applies for fixing this issue (Parse Bounty Program)type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions