Commit 32dd42f0 authored by Florie Guibert's avatar Florie Guibert

Merge boards Apollo client

Changelog: changed
parent 14d84f97
...@@ -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 } from 'apollo-cache-inmemory'; import { IntrospectionFragmentMatcher, defaultDataIdFromObject } from 'apollo-cache-inmemory';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import introspectionQueryResultData from '~/sidebar/fragmentTypes.json'; import introspectionQueryResultData from '~/sidebar/fragmentTypes.json';
...@@ -10,6 +10,11 @@ export const gqlClient = createDefaultClient( ...@@ -10,6 +10,11 @@ export const gqlClient = createDefaultClient(
{}, {},
{ {
cacheConfig: { cacheConfig: {
dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle
return object.__typename === 'BoardList' ? object.iid : defaultDataIdFromObject(object);
},
fragmentMatcher, fragmentMatcher,
}, },
assumeImmutableResults: true, 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 {
...@@ -16,10 +17,7 @@ fragment IssueNode on Issue { ...@@ -16,10 +17,7 @@ fragment IssueNode on Issue {
webUrl webUrl
relativePosition relativePosition
milestone { milestone {
expired ...MilestoneFragment
id
state
title
} }
assignees { assignees {
nodes { nodes {
......
fragment MilestoneFragment on Milestone {
expired
id
state
title
}
...@@ -14,6 +14,7 @@ import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils'; ...@@ -14,6 +14,7 @@ import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { initRails } from '~/lib/utils/rails_ujs'; import { initRails } from '~/lib/utils/rails_ujs';
import * as popovers from '~/popovers'; import * as popovers from '~/popovers';
import * as tooltips from '~/tooltips'; import * as tooltips from '~/tooltips';
import { initHeaderSearchApp } from '~/header_search';
import initAlertHandler from './alert_handler'; import initAlertHandler from './alert_handler';
import { removeFlashClickListener } from './flash'; import { removeFlashClickListener } from './flash';
import initTodoToggle from './header'; import initTodoToggle from './header';
...@@ -35,7 +36,6 @@ import GlFieldErrors from './gl_field_errors'; ...@@ -35,7 +36,6 @@ import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers'; import initUserPopovers from './user_popovers';
import initBroadcastNotifications from './broadcast_notification'; import initBroadcastNotifications from './broadcast_notification';
import { initTopNav } from './nav'; import { initTopNav } from './nav';
import { initHeaderSearchApp } from '~/header_search';
import 'ee_else_ce/main_ee'; import 'ee_else_ce/main_ee';
import 'jh_else_ce/main_jh'; import 'jh_else_ce/main_jh';
......
#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 {
...@@ -26,10 +27,7 @@ fragment IssueNode on Issue { ...@@ -26,10 +27,7 @@ fragment IssueNode on Issue {
} }
} }
milestone { milestone {
expired ...MilestoneFragment
id
state
title
} }
labels { labels {
nodes { nodes {
......
...@@ -119,6 +119,7 @@ RSpec.describe 'epics swimlanes', :js do ...@@ -119,6 +119,7 @@ RSpec.describe 'epics swimlanes', :js do
end end
it 'between lists and epics' do it 'between lists and epics' do
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
wait_for_board_cards(1, 2) wait_for_board_cards(1, 2)
wait_for_board_cards_in_second_epic(1, 1) wait_for_board_cards_in_second_epic(1, 1)
...@@ -129,6 +130,7 @@ RSpec.describe 'epics swimlanes', :js do ...@@ -129,6 +130,7 @@ RSpec.describe 'epics swimlanes', :js do
wait_for_board_cards_in_first_epic(2, 2) wait_for_board_cards_in_first_epic(2, 2)
end end
end end
end
context 'drag and drop list' do context 'drag and drop list' do
let_it_be(:label2) { create(:label, project: project, name: 'Label 2') } let_it_be(:label2) { create(:label, project: project, name: 'Label 2') }
......
...@@ -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