@@ -43,32 +43,22 @@ const emits = defineEmits<{
43
43
(e : ' close' ): void ;
44
44
(e : ' click-primary-action' , value : string ): Promise <void >;
45
45
(e : ' click-secondary-action' ): void ;
46
- (e : ' update:modelValue' , value : string ): void ;
47
46
}>();
48
47
49
48
const i18n = useI18n ();
50
49
const container = ref <HTMLDivElement | null >(null );
51
- const modalValue = ref <string >(' ' );
52
50
53
- const model = computed ({
54
- get() {
55
- return props .open ? props .name .slice (0 , MAX_VIEW_NAME_LENGTH ) : ' ' ;
56
- },
57
- set(value : string ) {
58
- modalValue .value = value ;
59
- emits (' update:modelValue' , value );
60
- },
61
- });
51
+ const model = computed (() => props .open ? props .name .slice (0 , MAX_VIEW_NAME_LENGTH ) : ' ' );
62
52
63
53
const hasSameNameError = computed (() => props .viewNames ?.some (
64
- (viewName ) => viewName .trim ().toLowerCase () === modalValue .value .trim ().toLowerCase (),
54
+ (viewName ) => viewName .trim ().toLowerCase () === model .value .trim ().toLowerCase (),
65
55
));
66
56
67
57
const isPrimaryActionDisabled = computed (() => {
68
58
return props .isModalLoading ||
69
59
hasSameNameError .value ||
70
- ! modalValue .value ||
71
- modalValue .value .length > MAX_VIEW_NAME_LENGTH ;
60
+ ! model .value ||
61
+ model .value .length > MAX_VIEW_NAME_LENGTH ;
72
62
});
73
63
74
64
const primaryAction = computed (() => ({
@@ -88,7 +78,7 @@ const errorMessage = computed(() =>
88
78
hasSameNameError .value
89
79
? i18n .translate (
90
80
' Polaris.Tabs.DuplicateModal.errors.sameName' ,
91
- { name: modalValue .value },
81
+ { name: model .value },
92
82
)
93
83
: undefined ,
94
84
);
@@ -113,7 +103,7 @@ const handlePrimaryAction = async () => {
113
103
return ;
114
104
}
115
105
116
- await emits (' click-primary-action' , modalValue .value );
106
+ await emits (' click-primary-action' , model .value );
117
107
model .value = ' ' ;
118
108
emits (' close' );
119
109
}
0 commit comments