Skip to content

Commit 785cccf

Browse files
committed
Adding new list then adds the location
1 parent 4f1a01d commit 785cccf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/components/entry/overview/SaveToListButton.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,14 @@ const SaveToListButton = ({ containerRef }) => {
234234
setNewListName('')
235235
}
236236

237-
const handleConfirmNewList = () => {
237+
const handleConfirmNewList = async () => {
238238
const trimmed = newListName.trim()
239239
if (trimmed) {
240-
dispatch(addList({ name: trimmed }))
240+
const resultAction = await dispatch(addList({ name: trimmed }))
241+
if (addList.fulfilled.match(resultAction)) {
242+
const newList = resultAction.payload
243+
dispatch(addLocationToList({ listId: newList.id, location }))
244+
}
241245
}
242246
setAddingNew(false)
243247
setNewListName('')

0 commit comments

Comments
 (0)