Commit 6029f640 authored by Natalia Tepluhina's avatar Natalia Tepluhina Committed by Filipa Lacerda

Resolve "Error when uploading a few designs in a row"

parent c8f5576c
---
title: Resolve Error when uploading a few designs in a row
merge_request: 18811
author:
type: fixed
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import _ from 'underscore';
import { defaultDataIdFromObject } from 'apollo-cache-inmemory';
import createDefaultClient from '~/lib/graphql';
import createFlash from '~/flash';
......@@ -46,7 +47,7 @@ const defaultClient = createDefaultClient(
dataIdFromObject: object => {
// eslint-disable-next-line no-underscore-dangle, @gitlab/i18n/no-non-i18n-strings
if (object.__typename === 'Design') {
return object.id && object.image ? `${object.id}-${object.image}` : null;
return object.id && object.image ? `${object.id}-${object.image}` : _.uniqueId();
}
return defaultDataIdFromObject(object);
},
......
......@@ -24,7 +24,7 @@ describe 'User uploads new design', :js do
wait_for_requests
end
it 'uploads design' do
it 'uploads designs' do
attach_file(:design_file, logo_fixture, make_visible: true)
expect(page).to have_selector('.js-design-list-item', count: 1)
......@@ -32,6 +32,10 @@ describe 'User uploads new design', :js do
within first('#designs-tab .card') do
expect(page).to have_content('dk.png')
end
attach_file(:design_file, gif_fixture, make_visible: true)
expect(page).to have_selector('.js-design-list-item', count: 2)
end
end
......@@ -48,4 +52,8 @@ describe 'User uploads new design', :js do
def logo_fixture
Rails.root.join('spec', 'fixtures', 'dk.png')
end
def gif_fixture
Rails.root.join('spec', 'fixtures', 'banana_sample.gif')
end
end
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