@@ -16,7 +16,6 @@ import { clearDraft } from '~/lib/utils/autosave';
1616import { isMetaEnterKeyPair } from ' ~/lib/utils/common_utils' ;
1717import { getParameterByName } from ' ~/lib/utils/url_utility' ;
1818import { convertToGraphQLId } from ' ~/graphql_shared/utils' ;
19- import { fetchPolicies } from ' ~/lib/graphql' ;
2019import { s__ , sprintf } from ' ~/locale' ;
2120import * as Sentry from ' ~/sentry/sentry_browser_wrapper' ;
2221import { addHierarchyChild , setNewWorkItemCache } from ' ~/work_items/graphql/cache_utils' ;
@@ -193,9 +192,9 @@ export default {
193192 data () {
194193 return {
195194 isTitleValid: true ,
196- workItemTitle: this .title || ' ' ,
197195 isConfidential: false ,
198196 isRelatedToItem: true ,
197+ localTitle: this .title || ' ' ,
199198 error: null ,
200199 workItemTypes: [],
201200 selectedProjectFullPath: this .initialSelectedProject (),
@@ -225,11 +224,6 @@ export default {
225224 return this .skipWorkItemQuery ;
226225 },
227226 update (data ) {
228- const title = data? .workspace ? .workItem ? .title ;
229-
230- if (this .isTitleFilled (title)) {
231- this .updateTitle (title);
232- }
233227 return data? .workspace ? .workItem ?? {};
234228 },
235229 result () {
@@ -243,9 +237,6 @@ export default {
243237 query () {
244238 return namespaceWorkItemTypesQuery;
245239 },
246- fetchPolicy () {
247- return this .workItemTypeName ? fetchPolicies .CACHE_ONLY : fetchPolicies .CACHE_FIRST ;
248- },
249240 variables () {
250241 return {
251242 fullPath: this .selectedProjectFullPath ,
@@ -460,6 +451,9 @@ export default {
460451 const healthStatusWidget = findWidget (WIDGET_TYPE_HEALTH_STATUS , this .workItem );
461452 return healthStatusWidget? .healthStatus || null ;
462453 },
454+ workItemTitle () {
455+ return this .localTitle || this .workItem ? .title || this .title ;
456+ },
463457 workItemDescription () {
464458 const descriptionWidget = findWidget (WIDGET_TYPE_DESCRIPTION , this .workItem );
465459 return descriptionWidget? .description || this .description ;
@@ -576,13 +570,6 @@ export default {
576570 this .createWorkItem ();
577571 }
578572 },
579- isTitleFilled (newValue ) {
580- const title = newValue ?? this .workItemTitle ;
581- return Boolean (String (title).trim ());
582- },
583- updateTitle (newValue ) {
584- this .workItemTitle = newValue;
585- },
586573 validateAllowedParentTypes (selectedWorkItemType ) {
587574 return (
588575 this .workItemTypes
@@ -596,8 +583,8 @@ export default {
596583 this .selectedWorkItemType ? .widgetDefinitions ? .flatMap ((i ) => i .type ) || [];
597584 return widgetDefinitions .indexOf (widgetType) !== - 1 ;
598585 },
599- validate (newValue ) {
600- this .isTitleValid = this .isTitleFilled (newValue );
586+ validate () {
587+ this .isTitleValid = Boolean ( String ( this .workItemTitle ). trim () );
601588 },
602589 setNumberOfDiscussionsResolved () {
603590 if (this .discussionToResolve || this .mergeRequestToResolveDiscussionsOf ) {
@@ -607,7 +594,7 @@ export default {
607594 },
608595 async updateDraftData (type , value ) {
609596 if (type === ' title' ) {
610- this .workItemTitle = value;
597+ this .localTitle = value;
611598 }
612599
613600 try {
0 commit comments