Commit d20ba0b5 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'ntepluhina-merge-apollo-clients' into 'master'

Merge boards Apollo Client instances for boards [RUN AS-if-FOSS]

See merge request gitlab-org/gitlab!70375
parents 741d08ea 32dd42f0
...@@ -146,7 +146,8 @@ export function getMoveData(state, params) { ...@@ -146,7 +146,8 @@ export function getMoveData(state, params) {
} }
export function moveItemListHelper(item, fromList, toList) { export function moveItemListHelper(item, fromList, toList) {
const updatedItem = item; const updatedItem = cloneDeep(item);
if ( if (
toList.listType === ListType.label && toList.listType === ListType.label &&
!updatedItem.labels.find((label) => label.id === toList.label.id) !updatedItem.labels.find((label) => label.id === toList.label.id)
......
import { IntrospectionFragmentMatcher, defaultDataIdFromObject } from 'apollo-cache-inmemory';
import createDefaultClient from '~/lib/graphql';
import introspectionQueryResultData from '~/sidebar/fragmentTypes.json';
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
});
export const gqlClient = createDefaultClient(
{},
{
cacheConfig: {
dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle
return object.__typename === 'BoardList' ? object.iid : defaultDataIdFromObject(object);
},
fragmentMatcher,
},
assumeImmutableResults: true,
},
);
#import "~/graphql_shared/fragments/milestone.fragment.graphql"
#import "~/graphql_shared/fragments/user.fragment.graphql" #import "~/graphql_shared/fragments/user.fragment.graphql"
fragment IssueNode on Issue { fragment IssueNode on Issue {
...@@ -15,6 +16,9 @@ fragment IssueNode on Issue { ...@@ -15,6 +16,9 @@ fragment IssueNode on Issue {
hidden hidden
webUrl webUrl
relativePosition relativePosition
milestone {
...MilestoneFragment
}
assignees { assignees {
nodes { nodes {
...User ...User
......
import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import PortalVue from 'portal-vue'; import PortalVue from 'portal-vue';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
...@@ -14,30 +13,17 @@ import FilteredSearchBoards from '~/boards/filtered_search_boards'; ...@@ -14,30 +13,17 @@ import FilteredSearchBoards from '~/boards/filtered_search_boards';
import initBoardsFilteredSearch from '~/boards/mount_filtered_search_issue_boards'; import initBoardsFilteredSearch from '~/boards/mount_filtered_search_issue_boards';
import store from '~/boards/stores'; import store from '~/boards/stores';
import toggleFocusMode from '~/boards/toggle_focus'; import toggleFocusMode from '~/boards/toggle_focus';
import createDefaultClient from '~/lib/graphql';
import { NavigationType, parseBoolean } from '~/lib/utils/common_utils'; import { NavigationType, parseBoolean } from '~/lib/utils/common_utils';
import introspectionQueryResultData from '~/sidebar/fragmentTypes.json';
import { fullBoardId } from './boards_util'; import { fullBoardId } from './boards_util';
import boardConfigToggle from './config_toggle'; import boardConfigToggle from './config_toggle';
import { gqlClient } from './graphql';
import mountMultipleBoardsSwitcher from './mount_multiple_boards_switcher'; import mountMultipleBoardsSwitcher from './mount_multiple_boards_switcher';
Vue.use(VueApollo); Vue.use(VueApollo);
Vue.use(PortalVue); Vue.use(PortalVue);
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
});
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient( defaultClient: gqlClient,
{},
{
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
},
),
}); });
function mountBoardApp(el) { function mountBoardApp(el) {
......
...@@ -19,7 +19,6 @@ import { ...@@ -19,7 +19,6 @@ import {
import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql'; import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql';
import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql'; import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import createGqClient, { fetchPolicies } from '~/lib/graphql';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { queryToObject } from '~/lib/utils/url_utility'; import { queryToObject } from '~/lib/utils/url_utility';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -35,6 +34,7 @@ import { ...@@ -35,6 +34,7 @@ import {
FiltersInfo, FiltersInfo,
filterVariables, filterVariables,
} from '../boards_util'; } from '../boards_util';
import { gqlClient } from '../graphql';
import boardLabelsQuery from '../graphql/board_labels.query.graphql'; import boardLabelsQuery from '../graphql/board_labels.query.graphql';
import groupBoardIterationsQuery from '../graphql/group_board_iterations.query.graphql'; import groupBoardIterationsQuery from '../graphql/group_board_iterations.query.graphql';
import groupBoardMilestonesQuery from '../graphql/group_board_milestones.query.graphql'; import groupBoardMilestonesQuery from '../graphql/group_board_milestones.query.graphql';
...@@ -47,13 +47,6 @@ import projectBoardMilestonesQuery from '../graphql/project_board_milestones.que ...@@ -47,13 +47,6 @@ import projectBoardMilestonesQuery from '../graphql/project_board_milestones.que
import * as types from './mutation_types'; import * as types from './mutation_types';
export const gqlClient = createGqClient(
{},
{
fetchPolicy: fetchPolicies.NO_CACHE,
},
);
export default { export default {
setInitialBoardData: ({ commit }, data) => { setInitialBoardData: ({ commit }, data) => {
commit(types.SET_INITIAL_BOARD_DATA, data); commit(types.SET_INITIAL_BOARD_DATA, data);
......
fragment MilestoneFragment on Milestone {
expired
id
state
title
}
#import "~/graphql_shared/fragments/milestone.fragment.graphql"
#import "~/graphql_shared/fragments/user.fragment.graphql" #import "~/graphql_shared/fragments/user.fragment.graphql"
fragment IssueNode on Issue { fragment IssueNode on Issue {
...@@ -25,6 +26,9 @@ fragment IssueNode on Issue { ...@@ -25,6 +26,9 @@ fragment IssueNode on Issue {
...User ...User
} }
} }
milestone {
...MilestoneFragment
}
labels { labels {
nodes { nodes {
id id
......
...@@ -6,10 +6,11 @@ import { ...@@ -6,10 +6,11 @@ import {
filterVariables, filterVariables,
} from '~/boards/boards_util'; } from '~/boards/boards_util';
import { BoardType } from '~/boards/constants'; import { BoardType } from '~/boards/constants';
import { gqlClient } from '~/boards/graphql';
import groupBoardMembersQuery from '~/boards/graphql/group_board_members.query.graphql'; import groupBoardMembersQuery from '~/boards/graphql/group_board_members.query.graphql';
import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql'; import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql';
import projectBoardMembersQuery from '~/boards/graphql/project_board_members.query.graphql'; import projectBoardMembersQuery from '~/boards/graphql/project_board_members.query.graphql';
import actionsCE, { gqlClient } from '~/boards/stores/actions'; import actionsCE from '~/boards/stores/actions';
import * as typesCE from '~/boards/stores/mutation_types'; import * as typesCE from '~/boards/stores/mutation_types';
import { historyPushState, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { historyPushState, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { mergeUrlParams, removeParams, queryToObject } from '~/lib/utils/url_utility'; import { mergeUrlParams, removeParams, queryToObject } from '~/lib/utils/url_utility';
......
...@@ -119,14 +119,16 @@ RSpec.describe 'epics swimlanes', :js do ...@@ -119,14 +119,16 @@ RSpec.describe 'epics swimlanes', :js do
end end
it 'between lists and epics' do it 'between lists and epics' do
wait_for_board_cards(1, 2) inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
wait_for_board_cards_in_second_epic(1, 1) wait_for_board_cards(1, 2)
wait_for_board_cards_in_second_epic(1, 1)
drag(list_from_index: 4, list_to_index: 2) drag(list_from_index: 4, list_to_index: 2)
wait_for_board_cards(2, 0) wait_for_board_cards(2, 0)
wait_for_board_cards(3, 2) wait_for_board_cards(3, 2)
wait_for_board_cards_in_first_epic(2, 2) wait_for_board_cards_in_first_epic(2, 2)
end
end end
end end
......
...@@ -21,9 +21,10 @@ import { ...@@ -21,9 +21,10 @@ import {
getMoveData, getMoveData,
updateListPosition, updateListPosition,
} from '~/boards/boards_util'; } from '~/boards/boards_util';
import { gqlClient } from '~/boards/graphql';
import destroyBoardListMutation from '~/boards/graphql/board_list_destroy.mutation.graphql'; import destroyBoardListMutation from '~/boards/graphql/board_list_destroy.mutation.graphql';
import issueCreateMutation from '~/boards/graphql/issue_create.mutation.graphql'; import issueCreateMutation from '~/boards/graphql/issue_create.mutation.graphql';
import actions, { gqlClient } from '~/boards/stores/actions'; import actions from '~/boards/stores/actions';
import * as types from '~/boards/stores/mutation_types'; import * as types from '~/boards/stores/mutation_types';
import mutations from '~/boards/stores/mutations'; import mutations from '~/boards/stores/mutations';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment