@@ -16,7 +16,6 @@ import { clearDraft } from '~/lib/utils/autosave';
16
16
import { isMetaEnterKeyPair } from ' ~/lib/utils/common_utils' ;
17
17
import { getParameterByName } from ' ~/lib/utils/url_utility' ;
18
18
import { convertToGraphQLId } from ' ~/graphql_shared/utils' ;
19
- import { fetchPolicies } from ' ~/lib/graphql' ;
20
19
import { s__ , sprintf } from ' ~/locale' ;
21
20
import * as Sentry from ' ~/sentry/sentry_browser_wrapper' ;
22
21
import { addHierarchyChild , setNewWorkItemCache } from ' ~/work_items/graphql/cache_utils' ;
@@ -193,9 +192,9 @@ export default {
193
192
data () {
194
193
return {
195
194
isTitleValid: true ,
196
- workItemTitle: this .title || ' ' ,
197
195
isConfidential: false ,
198
196
isRelatedToItem: true ,
197
+ localTitle: this .title || ' ' ,
199
198
error: null ,
200
199
workItemTypes: [],
201
200
selectedProjectFullPath: this .initialSelectedProject (),
@@ -225,11 +224,6 @@ export default {
225
224
return this .skipWorkItemQuery ;
226
225
},
227
226
update (data ) {
228
- const title = data? .workspace ? .workItem ? .title ;
229
-
230
- if (this .isTitleFilled (title)) {
231
- this .updateTitle (title);
232
- }
233
227
return data? .workspace ? .workItem ?? {};
234
228
},
235
229
result () {
@@ -243,9 +237,6 @@ export default {
243
237
query () {
244
238
return namespaceWorkItemTypesQuery;
245
239
},
246
- fetchPolicy () {
247
- return this .workItemTypeName ? fetchPolicies .CACHE_ONLY : fetchPolicies .CACHE_FIRST ;
248
- },
249
240
variables () {
250
241
return {
251
242
fullPath: this .selectedProjectFullPath ,
@@ -460,6 +451,9 @@ export default {
460
451
const healthStatusWidget = findWidget (WIDGET_TYPE_HEALTH_STATUS , this .workItem );
461
452
return healthStatusWidget? .healthStatus || null ;
462
453
},
454
+ workItemTitle () {
455
+ return this .localTitle || this .workItem ? .title || this .title ;
456
+ },
463
457
workItemDescription () {
464
458
const descriptionWidget = findWidget (WIDGET_TYPE_DESCRIPTION , this .workItem );
465
459
return descriptionWidget? .description || this .description ;
@@ -576,13 +570,6 @@ export default {
576
570
this .createWorkItem ();
577
571
}
578
572
},
579
- isTitleFilled (newValue ) {
580
- const title = newValue ?? this .workItemTitle ;
581
- return Boolean (String (title).trim ());
582
- },
583
- updateTitle (newValue ) {
584
- this .workItemTitle = newValue;
585
- },
586
573
validateAllowedParentTypes (selectedWorkItemType ) {
587
574
return (
588
575
this .workItemTypes
@@ -596,8 +583,8 @@ export default {
596
583
this .selectedWorkItemType ? .widgetDefinitions ? .flatMap ((i ) => i .type ) || [];
597
584
return widgetDefinitions .indexOf (widgetType) !== - 1 ;
598
585
},
599
- validate (newValue ) {
600
- this .isTitleValid = this .isTitleFilled (newValue );
586
+ validate () {
587
+ this .isTitleValid = Boolean ( String ( this .workItemTitle ). trim () );
601
588
},
602
589
setNumberOfDiscussionsResolved () {
603
590
if (this .discussionToResolve || this .mergeRequestToResolveDiscussionsOf ) {
@@ -607,7 +594,7 @@ export default {
607
594
},
608
595
async updateDraftData (type , value ) {
609
596
if (type === ' title' ) {
610
- this .workItemTitle = value;
597
+ this .localTitle = value;
611
598
}
612
599
613
600
try {
0 commit comments