Skip to content

Save operation failed but data saved to cache? #5564

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

Closed
uzaysan opened this issue May 5, 2019 · 4 comments
Closed

Save operation failed but data saved to cache? #5564

uzaysan opened this issue May 5, 2019 · 4 comments

Comments

@uzaysan
Copy link

uzaysan commented May 5, 2019

When i tried to update my username new username writed to cache(ParseUser.getCurrentUser()) even process failed.

For example:

ParseUser.getCurrentUser().setUsername(newusername);
                                ParseUser.getCurrentUser().saveInBackground(new SaveCallback() {
                                    @Override
                                    public void done(ParseException e) {
                                        if(e==null){
                                            //username updated
                                        }
                                        else{
                                            //Write failed because username already taken
                                            // username didnt updated in databse but updated in cache 
                                            //ParseUser.getCurrentUser().getUsername() returns failed username
                                        }
                                    }
                                });

I'm using this version:

implementation "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"

@TomWFox
Copy link
Contributor

TomWFox commented May 5, 2019

Please provide any specific errors you are receiving client side & relevant logs from Parse Server also what version of Parse Server are you using?

(in future please fill out the issue template)

@uzaysan
Copy link
Author

uzaysan commented May 5, 2019

Please provide any specific errors you are receiving client side & relevant logs from Parse Server also what version of Parse Server are you using?

(in future please fill out the issue template)

App doesn't crash and gives no error log. I dont know what parse server version I'm using. I used deploy heroku button 2 weeks ago.
I found a tricky workaround solution.

ParseUser.getCurrentUser().setUsername(usernameedittext.getText().toString());
                                ParseUser.getCurrentUser().saveInBackground(new SaveCallback() {
                                    @Override
                                    public void done(ParseException e) {
                                        if(e==null){
                                            

                                            //username updated succesfully
                                        }
                                        else{
                                            //update failed 
                                            //save old username
                                            ParseUser.getCurrentUser().setUsername(oldusername);
                                            ParseUser.getCurrentUser().saveInBackground(new SaveCallback() {
                                                @Override
                                                public void done(ParseException e) {
                                                    if(e==null){
                                                        
                                                    }

                                                }
                                            });
                                        }
                                    }
                                });

@uzaysan
Copy link
Author

uzaysan commented May 6, 2019

@TomWFox this issue is same with my issue
parse-community/Parse-SDK-iOS-OSX#51

@acinader
Copy link
Contributor

If you are still having an issue and have determined what version of the sdk and server you are using, please open an issue on the Android SDK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants