Skip to content

Commit

Permalink
Show AutomcompleteInput even if the list of playlists is not loaded yet
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed May 26, 2020
1 parent 1607dc8 commit 9c940cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ui/src/dialogs/AddToPlaylistDialog.js
Expand Up @@ -25,7 +25,7 @@ const AddToPlaylistDialog = () => {
const notify = useNotify()
const [value, setValue] = useState({})
const dataProvider = useDataProvider()
const [create] = useCreate(
const [createAndAddToPlaylist] = useCreate(
'playlist',
{ name: value.name },
{
Expand Down Expand Up @@ -74,7 +74,7 @@ const AddToPlaylistDialog = () => {
if (value.id) {
addToPlaylist(value.id)
} else {
create()
createAndAddToPlaylist()
}
dispatch(closeAddToPlaylist())
e.stopPropagation()
Expand Down
8 changes: 2 additions & 6 deletions ui/src/dialogs/SelectPlaylistInput.js
Expand Up @@ -11,18 +11,14 @@ const filter = createFilterOptions()

const SelectPlaylistInput = ({ onChange }) => {
const translate = useTranslate()
const { ids, data, loaded } = useGetList(
const { ids, data } = useGetList(
'playlist',
{ page: 1, perPage: -1 },
{ field: 'name', order: 'ASC' },
{}
)

if (!loaded) {
return null
}

const options = ids.map((id) => data[id])
const options = ids && ids.map((id) => data[id])

const handleOnChange = (event, newValue) => {
if (newValue == null) {
Expand Down

0 comments on commit 9c940cd

Please sign in to comment.