File tree 2 files changed +6
-4
lines changed
gui/src/renderer/components/select-location
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -147,14 +147,15 @@ export function EditListDialog(props: EditListProps) {
147
147
const { updateCustomList } = useAppContext ( ) ;
148
148
149
149
const [ newName , setNewName ] = useState ( props . list . name ) ;
150
- const newNameValid = newName . trim ( ) !== '' ;
150
+ const newNameTrimmed = newName . trim ( )
151
+ const newNameValid = newNameTrimmed !== '' ;
151
152
const [ error , setError , unsetError ] = useBoolean ( ) ;
152
153
153
154
// Update name in list and save it.
154
155
const save = useCallback ( async ( ) => {
155
156
if ( newNameValid ) {
156
157
try {
157
- const updatedList = { ...props . list , name : newName . trim ( ) } ;
158
+ const updatedList = { ...props . list , name : newNameTrimmed } ;
158
159
const result = await updateCustomList ( updatedList ) ;
159
160
if ( result && result . type === 'name already exists' ) {
160
161
setError ( ) ;
Original file line number Diff line number Diff line change @@ -123,7 +123,8 @@ interface AddListFormProps {
123
123
124
124
function AddListForm ( props : AddListFormProps ) {
125
125
const [ name , setName ] = useState ( '' ) ;
126
- const nameValid = name . trim ( ) !== '' ;
126
+ const nameTrimmed = name . trim ( )
127
+ const nameValid = nameTrimmed !== '' ;
127
128
const [ error , setError , unsetError ] = useBoolean ( ) ;
128
129
const containerRef = useStyledRef < HTMLDivElement > ( ) ;
129
130
const inputRef = useStyledRef < HTMLInputElement > ( ) ;
@@ -137,7 +138,7 @@ function AddListForm(props: AddListFormProps) {
137
138
const createList = useCallback ( async ( ) => {
138
139
if ( nameValid ) {
139
140
try {
140
- const result = await props . onCreateList ( name . trim ( ) ) ;
141
+ const result = await props . onCreateList ( nameTrimmed ) ;
141
142
if ( result ) {
142
143
setError ( ) ;
143
144
}
You can’t perform that action at this time.
0 commit comments