diff --git a/ui/package-lock.json b/ui/package-lock.json index 4cb4e8236..84e8cc2e9 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -10721,11 +10721,6 @@ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" - }, "lodash.isequalwith": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.isequalwith/-/lodash.isequalwith-4.4.0.tgz", diff --git a/ui/package.json b/ui/package.json index 257d8610d..fc73fa7d5 100644 --- a/ui/package.json +++ b/ui/package.json @@ -11,7 +11,6 @@ "deepmerge": "^4.2.2", "history": "^4.10.1", "jwt-decode": "^3.1.2", - "lodash.get": "^4.4.2", "lodash.pick": "^4.4.0", "lodash.throttle": "^4.1.1", "md5-hex": "^3.0.1", diff --git a/ui/src/common/MultiLineTextField.js b/ui/src/common/MultiLineTextField.js index bc36326a3..c11b36a1f 100644 --- a/ui/src/common/MultiLineTextField.js +++ b/ui/src/common/MultiLineTextField.js @@ -1,5 +1,4 @@ import React, { memo } from 'react' -import get from 'lodash.get' import Typography from '@material-ui/core/Typography' import sanitizeFieldRestProps from './sanitizeFieldRestProps' import md5 from 'md5-hex' @@ -15,7 +14,7 @@ export const MultiLineTextField = memo( addLabel, ...rest }) => { - const value = get(record, source) + const value = record && record[source] let lines = value ? value.split('\n') : [] if (maxLines || firstLine) { lines = lines.slice(firstLine, maxLines) diff --git a/ui/src/common/SongTitleField.js b/ui/src/common/SongTitleField.js index 66d535313..438bed606 100644 --- a/ui/src/common/SongTitleField.js +++ b/ui/src/common/SongTitleField.js @@ -3,7 +3,6 @@ import React from 'react' import PropTypes from 'prop-types' import { useSelector } from 'react-redux' import { FunctionField } from 'react-admin' -import get from 'lodash.get' import { useTheme } from '@material-ui/core/styles' import PlayingLight from '../icons/playing-light.gif' import PlayingDark from '../icons/playing-dark.gif' @@ -28,7 +27,7 @@ export const SongTitleField = ({ showTrackNumbers, ...props }) => { const theme = useTheme() const classes = useStyles() const { record } = props - const currentTrack = useSelector((state) => get(state, 'queue.current', {})) + const currentTrack = useSelector((state) => state?.queue?.current || {}) const currentId = currentTrack.trackId const paused = currentTrack.paused const isCurrent = diff --git a/ui/src/common/useAlbumsPerPage.js b/ui/src/common/useAlbumsPerPage.js index 5e1ec51c3..6d3edf046 100644 --- a/ui/src/common/useAlbumsPerPage.js +++ b/ui/src/common/useAlbumsPerPage.js @@ -1,5 +1,4 @@ import { useSelector } from 'react-redux' -import get from 'lodash.get' const getPerPage = (width) => { if (width === 'xs') return 12 @@ -19,8 +18,8 @@ const getPerPageOptions = (width) => { export const useAlbumsPerPage = (width) => { const perPage = - useSelector((state) => - get(state.admin.resources, ['album', 'list', 'params', 'perPage']) + useSelector( + (state) => state?.admin.resources?.album?.list?.params?.perPage ) || getPerPage(width) return [perPage, getPerPageOptions(width)] diff --git a/ui/src/reducers/playQueue.js b/ui/src/reducers/playQueue.js index 6b6f943fe..2855a1681 100644 --- a/ui/src/reducers/playQueue.js +++ b/ui/src/reducers/playQueue.js @@ -1,5 +1,4 @@ import 'react-jinke-music-player/assets/index.css' -import get from 'lodash.get' import { v4 as uuidv4 } from 'uuid' import subsonic from '../subsonic' import config from '../config' @@ -85,7 +84,7 @@ export const playQueueReducer = (previousState = initialState, payload) => { }) return { ...previousState, queue, clear: false, playIndex: undefined } case PLAYER_PLAY_NEXT: - current = get(previousState.current, 'uuid', '') + current = previousState.current?.uuid || '' newQueue = [] let foundPos = false previousState.queue.forEach((item) => {