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

Fix morphTo options.query #2059

Merged
merged 5 commits into from
Mar 2, 2020

Conversation

Znarkus
Copy link
Contributor

@Znarkus Znarkus commented Feb 27, 2020

Don't use same query builder for all candidates

Introduction

fetching event gets same query builder for all morphTo candidates.

Motivation

We're using on('fetching', ..) to add deleted_at check for relations, but this fails for morphTo relations, since opts.query is the same regardless of candidate.

Proposed solution

Remove query from options prior to sending it to sync, solves this issue.

Current PR Issues

No issues known.

Alternatives considered

No alternatives considered.

Don't use same query builder for all candidates
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.

Can you add a test case for this issue? That should help ensure it's not re-introduced at a later time.

@Znarkus
Copy link
Contributor Author

Znarkus commented Feb 28, 2020

@ricardograca Added a passing test (finally) that fails if I remove my fix.

@Znarkus
Copy link
Contributor Author

Znarkus commented Mar 2, 2020

@ricardograca I changed the test setup to better fit the existing structure, please check to see if it makes sense.

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.

Thanks! It's better now.

@ricardograca ricardograca merged commit da25f3d into bookshelf:master Mar 2, 2020
@Znarkus
Copy link
Contributor Author

Znarkus commented Mar 2, 2020

@ricardograca Great! Thanks. When can we expect the next version to be published?

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.

2 participants