Skip to content

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