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

Remove prune-undefined behavior from em.find, isolated to findGql #987

Open
stephenh opened this issue Mar 25, 2024 · 0 comments
Open

Remove prune-undefined behavior from em.find, isolated to findGql #987

stephenh opened this issue Mar 25, 2024 · 0 comments

Comments

@stephenh
Copy link
Collaborator

stephenh commented Mar 25, 2024

We've had 1 major bug plus the occasional "found before production but still surprises engineers" coming from em.find auto-pruning conditions that accidentally?surprisingly end up as undefined, i.e.:

  const approvers = await em.find(Approver, {
    user: prior.tradePartnerUser.get,
    viaTradePartnerMarketRole: tpmc.role,
    viaMarket: tpmc.market.id,
    approval: { isFinalized: false },
  });

It seems like a big enough foot gun that em.find should never prune, i.e. ^ user: undefined would be treated as "IS NULL" (or throw an error?).

We could probably also add opts:

  • pruneUndefined: false is default for em.find
  • pruneUndefined: true is the default for em.findGql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant