Skip to content

Conversation

@InvictusMB
Copy link
Contributor

@InvictusMB InvictusMB commented Oct 4, 2020

Split from #5592

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

@InvictusMB InvictusMB force-pushed the feature/ensure-filters-fk-source branch 2 times, most recently from c1316d4 to 5093027 Compare October 4, 2020 23:40
@InvictusMB
Copy link
Contributor Author

@bajtos wrote:

Yeah, I agree the callback-based version is much more complex and thus difficult to understand & reason about.

Reviewing this after some time, I don't think the callback version is that bad. The impact on inclusion resolver implementation is minimal and all the madness is contained within includeRelatedModels helper. I also believe that callback contract is more explicit than exposing metadata on a resolver function.

I think the callback-based version will also not work when including more than one relation, e.g. when geting all TodoList instances and including both the related Todo items (via hasMany) and the related TodoListImage (via hasOne).

It did work with whatever I'd throw at it, including multiple relations. includeRelatedModels would accumulate all requirements from all resolvers before actually fetching the entities.

@bajtos bajtos added community-contribution feature Repository Issues related to @loopback/repository package labels Oct 5, 2020
Signed-off-by: InvictusMB <invictusmb@gmail.com>
…n resolvers

Signed-off-by: InvictusMB <invictusmb@gmail.com>
…n resolvers

Signed-off-by: InvictusMB <invictusmb@gmail.com>
@InvictusMB InvictusMB force-pushed the feature/ensure-filters-fk-source branch from 5093027 to 3a07dea Compare October 7, 2020 15:45

fieldsAdded.forEach(f => (pruningMask[f] = undefined));
return resolveEntities(newFilter);
});
Copy link
Member

Choose a reason for hiding this comment

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

I am struggling to understand what is this code doing and what is the purpose of captureResult and captureInvocation. Let's try to find a simpler (less clever/smart) solution please, one that's easier to understand even to casual readers.

@stale
Copy link

stale bot commented Dec 25, 2020

This pull request has been marked stale because it has not seen activity within two months. It will be closed within 14 days of being stale unless there is new activity.

@stale stale bot added the stale label Dec 25, 2020
@stale stale bot removed the stale label Mar 11, 2021
@stale
Copy link

stale bot commented Jul 14, 2021

This pull request has been marked stale because it has not seen activity within two months. It will be closed within 14 days of being stale unless there is new activity.

@stale stale bot added the stale label Jul 14, 2021
@InvictusMB
Copy link
Contributor Author

Not stale. I'll have time to refresh this soon.

@stale stale bot removed the stale label Jul 27, 2021
@stale
Copy link

stale bot commented Sep 25, 2021

This pull request has been marked stale because it has not seen activity within two months. It will be closed within 14 days of being stale unless there is new activity.

@stale stale bot added the stale label Sep 25, 2021
@stale
Copy link

stale bot commented Oct 9, 2021

This pull request has been closed due to continued inactivity. If you are interested in finishing the proposed changes, then feel free to re-open this pull request or open a new one.

@stale stale bot closed this Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Repository Issues related to @loopback/repository package stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants