Projects with no releases shows an empty "template" on SaaS
Summary
A project that has no releases shows an empty "release template" on SaaS.
Steps to reproduce
- View a project that has a repository, but no releases.
Example Project
https://gitlab.com/gitlab-com/support/toolbox/gitlabsos/-/releases
What is the current bug behavior?
The releases page shows an empty "release template".
What is the expected correct behavior?
We should see something like the below (From 15.11.2):
Relevant logs
What I noticed is that in Browser tools, I see that the response on the /api/graphql
endpoint returns this:
[{"data":{"project":{"id":"gid://gitlab/Project/28460259","releases":null,"__typename":"Project"}}}]
On my 15.11.2 test instance, I get something like this on a project with no releases:
[{"data":{"project":{"id":"gid://gitlab/Project/12","releases":{"nodes":[],"pageInfo":{"startCursor":null,"hasPreviousPage":false,"hasNextPage":false,"endCursor":null,"__typename":"PageInfo"},"__typename":"ReleaseConnection"},"__typename":"Project"}}}]
Output of checks
This bug happens on GitLab.com - GitLab Enterprise Edition 16.1.0-pre 3f94ec39
Root cause
A recent change to the ReleasesResolver
in !120811 (merged) caused the /releases
page to break when a project does not have releases.
This is because !120811 (merged) updated the resolver to use BatchLoader
to support multiple projects as input, and only projects that have releases are mapped to a non-null value. This resulted in the GraphQL response to return a null
value instead of the expected empty array []
.
Solution
It was decided to move the ReleasesResolver
code into a new VersionsResolver
and revert the changes to ReleasesResolver
.
This both fixes the UI bug in this issue and continues to support the versions
field of CiCatalogResource
.
MR: Revert ReleasesResolver and add Ci Catalog Vers... (!122411 - merged)
Also added a feature test for this scenario: !122534 (merged)