Skip to content
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

Add option to control auto refresh after save #2070

Conversation

lysedaladvisa
Copy link
Contributor

@lysedaladvisa lysedaladvisa commented Apr 14, 2020

Introduction

Add option to control auto refresh after save.

Motivation

The newly introduced "auto refresh" functionality does not work properly in all cases yet and a part from that it might still be situations where you don't want/need to run the extra select query.

Proposed solution

Added the autoRefresh option to the save method to control weather or not auto refresh the model after save. Defaulted to true to not break the current behavior and also made it affect databases that supports the RETURNING statement for completeness. Of course there might not be many real life cases where you would turn it off for those.

Current PR Issues

Alternatives considered

Tried to get the refresh to actually work for my use case but gave up since even fixing the linked issue with "withSchema" option didn't solve everything. Don't have the time currently to get into this code base well enough to dig deeper into that and I believe this change is a reasonable thing to have and it solves the issue we are seeing.

Default to true to not break the current behavior and also made it
affect databases that supports the RETURNING statement for completeness.
Of course there might not be many real life cases where you would turn
it off for those.
@KendraArb
Copy link

Would love to see this implemented.

Copy link
Member

@ricardograca ricardograca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

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

Successfully merging this pull request may close these issues.

3 participants