I'm submitting a ...
PostGraphQL version:
alpha2.26
Minimal SQL file that can be loaded into a clean database:
CREATE TABLE room.liveroom (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL PRIMARY KEY,
display_name text NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL,
CONSTRAINT room_display_name_check CHECK (length(display_name) < 256)
);
insert into room.liveroom (display_name) values ('purple', 'red', 'blue', 'green');
Steps to reproduce:
Running postgraphql and sending:
query {
allLiverooms(orderBy: "CREATED_AT_DESC") {
nodes {
nodeId
}
}
}
Current behavior:
Spits out error about not being a constant
Expected behavior:
Treated as a constant, as it is generated by relay compiler from the .gql / .json schema files outputted by postgraphile
I believe the error you refer to (it would be handy to have a copy of it) is generated from GraphQL itself - constants must be specified without quotes (or they can be passed in via variables). The correct query would be:
query {
allLiverooms(orderBy: CREATED_AT_DESC) {
nodes {
nodeId
}
}
}
or
query AllLiverooms($orderBy: LiveroomOrderBy = CREATED_AT_DESC) {
allLiverooms(orderBy: $orderBy) {
nodes {
nodeId
}
}
}
The problem is the relay compiler. The constant is wrapped in quotes automatically, unless I use it in an array.
i.e.
- drawerRecentRooms : joinedRoomsByProfileId(first: 5, orderBy: JOINED_AT_DESC) {
+ drawerRecentRooms : joinedRoomsByProfileId(first: 5, orderBy: [JOINED_AT_DESC]) {
Then the relay compiler doesn't wrap it in quotes. Not sure where the bug is, here.
That鈥檚 really annoying; I was hoping the change to array orderBy would not be a breaking change. I think technically it isn鈥檛 but the change is triggering a weird behaviour in Relay.
Relay is definitely still in alpha as well, afaik :)
I think we've managed to push through this. Sorry (on Relay's behalf 馃槈) for the pain. I'm going to close this now 馃憤
Most helpful comment
Relay is definitely still in alpha as well, afaik :)