edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Illegal type union on `isActive` even though that property isn't selected

Open anubra266 opened this issue 2 years ago • 2 comments

I get this image

This is my query. isActive is a computed property on Membership type. I'm doing memberships because it's a multi link on User to the Membership type Membership is an abstract type, and OrgMembership is a polymorphic type that extends it

image

This is the generated edheQl

std::assert_single((WITH
  __scope_0_defaultUser := DETACHED default::User
SELECT __scope_0_defaultUser {
  created_at,
  email,
  updated_at,
  id,
  memberships := (
    WITH
      __scope_1_defaultMembership := __scope_0_defaultUser.memberships
    SELECT __scope_1_defaultMembership {
      [IS default::OrgMembership].role
    }
  )
}
FILTER (__scope_0_defaultUser.id = <std::uuid>"0a010d08-3484-11ee-9380-f3c6acf82edf")))

User type image

Abstract membership type image

OrgMembership type image

anubra266 avatar Aug 11 '23 19:08 anubra266

There is something peculiar with properties named isActive via QB. We get an error thrown at toEdgeQL on a simple select of an object including isActive: true.

[cause]: Error: Field "isActive" does not exist in default::User
      at shapeToEdgeQL (webpack-internal:///(api)/./dbschema/edgeql-js/toEdgeQL.mjs:709:23)
      at renderEdgeQL (webpack-internal:///(api)/./dbschema/edgeql-js/toEdgeQL.mjs:498:28)
      at Proxy.$toEdgeQL (webpack-internal:///(api)/./dbschema/edgeql-js/toEdgeQL.mjs:125:18)
      at Proxy.$queryFunc (webpack-internal:///(api)/./dbschema/edgeql-js/query.mjs:31:24)

Bizarrely, isActive does not show up on ["*"] for the object either.

Everything works as expected in EdgeQL. Move this to the JS repo @raddevon?

jackfischer avatar Aug 16 '23 13:08 jackfischer

Now seeing similar behavior with a computed boolean with a different name on a different object. So it is not the name isActive but perhaps something about booleans? But we've used booleans in countless places w/o issue. Really at a loss here.

jackfischer avatar Aug 16 '23 16:08 jackfischer