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

KendraArb commented Apr 30, 2020

Would love to see this implemented.

@ricardograca ricardograca added this to In progress in Version 1.x.x via automation Jun 7, 2020
Copy link
Member

@ricardograca ricardograca left a comment

Looks good.

@ricardograca ricardograca merged commit d729ae7 into bookshelf:master Jun 7, 2020
2 checks passed
Version 1.x.x automation moved this from In progress to Done Jun 7, 2020
@ricardograca ricardograca moved this from Done to Released 1.2.0 in Version 1.x.x Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Version 1.x.x
  
Released 1.2.0
Development

Successfully merging this pull request may close these issues.

None yet

3 participants