Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cache_config.js « graphql « table « components « jobs « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b9946925c95ec8cc44306cf87cb49526980b7009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { isEqual } from 'lodash';

export default {
  typePolicies: {
    Project: {
      fields: {
        jobs: {
          keyArgs: false,
        },
      },
    },
    CiJobConnection: {
      merge(existing = {}, incoming, { args = {} }) {
        let nodes;

        if (Object.keys(existing).length !== 0 && isEqual(existing?.statuses, args?.statuses)) {
          nodes = [...existing.nodes, ...incoming.nodes];
        } else {
          nodes = [...incoming.nodes];
        }

        return {
          nodes,
          statuses: Array.isArray(args.statuses) ? [...args.statuses] : args.statuses,
          pageInfo: incoming.pageInfo,
        };
      },
    },
  },
};