Skip to content

Changeset.nextSyncAt not populated when changeset is queried by ID

Created by: mrnugget

When a changeset is queried by ID, with the node(id: "foo") query, the nextSyncAt field is not populated:

https://github.com/sourcegraph/sourcegraph/blob/99b282364faa22cbf524c11c8a76831512989ebc/enterprise/internal/campaigns/resolvers/resolver.go#L73

What we need to do is load the sync data, like here:

https://github.com/sourcegraph/sourcegraph/blob/99b282364faa22cbf524c11c8a76831512989ebc/enterprise/internal/campaigns/resolvers/changesets.go#L96-L104

In the best case, we make this field "preload"-able: if the nextSyncAt is set when the resolver is initialized, we don't need to do anything. But if it's not set, we lazily load it when requested. We already do this for preloadedRepo:

https://github.com/sourcegraph/sourcegraph/blob/99b282364faa22cbf524c11c8a76831512989ebc/enterprise/internal/campaigns/resolvers/changesets.go#L157-L169