Generated typescript types ordering is nondeterministic for: View Relationships #810
Closed
2 tasks done
Labels
bug
Something isn't working
Bug report
Describe the bug
Apologies beforehand if this is the wrong repo -- I wasn't sure if the root of the issue was in type generation (another repo?) or just in the translation to typescript.
We ran into a bug where the generated typescript types were nondeterminstic using
supabase gen types typescript --local
. There is an unordered list or a race condition that causes the order of types to change randomly. This is blocking our Github action to diff the generated types file.The scenario that at least we repro'd is when it generates the types for a
View
that contains multiple FKs to the same table. In our case the table is self-referential but I don't know if that is a requirement. Here's a contrived example:Let's say we have the following schema for a
post
(table), which can point to a parent post:id
(uuid)body
(text)parent_post_id
(FK to post id, nullable)Then let's say we create a view where I get all the posts and some info about the parent post, if it has one:
When we generate the types, the view types will be:
The issue is that the order of the
Relationships
objects can change for reasons we haven't identified. It's difficult to repro locally with on the same commit, but after some code changes that do not affect the schema(?), or consistently on Github actions, we'll hit this. The result is a diff like:Here's our Github action:
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Relationships
of the View types can change.Expected behavior
The ordering of the
Relationships
of the View types is consistent.System information
Additional context
The text was updated successfully, but these errors were encountered: