mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 23:02:43 +01:00
fixed perf issue related to too many rerenders
rerenders were caused by strict equality check on object/array picks switched artistInfo to new store updated zustand and fixed deprecation warnings
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { selectMusic } from '@app/state/music'
|
||||
import { Store, useStore } from '@app/state/store'
|
||||
import { Store, useStore, useStoreDeep } from '@app/state/store'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
|
||||
export const useArtistInfo = (id: string) => {
|
||||
const artistInfo = useStore(useCallback((state: Store) => state.artistInfo[id], [id]))
|
||||
const fetchArtistInfo = useStore(selectMusic.fetchArtistInfo)
|
||||
const artistInfo = useStoreDeep(useCallback(store => store.entities.artistInfo[id], [id]))
|
||||
const fetchArtistInfo = useStore(store => store.fetchLibraryArtistInfo)
|
||||
|
||||
useEffect(() => {
|
||||
if (!artistInfo) {
|
||||
|
||||
Reference in New Issue
Block a user