React Query refactor (#91)

* initial react-query experiments

* use queries for item screens

send the data we do have over routing to prepopulate (album/playlist)
use number for starred because sending Date freaks out react-navigation

* add in equiv. song cover art fix

* reorg, switch artistview over

start mapping song cover art when any are available

* refactor useStar to queries

fix caching for starred items and album cover art

* add hook to reset queries on server change

* refactor search to use query

* fix song cover art setting

* use query for artistInfo

* remove last bits of library state

* cleanup

* use query key factory

already fixed one wrong key...

* require coverart size

* let's try no promise queues on these for now

* image cache uses query

* perf fix for playlist parsing

also use placeholder data so we don't have to deal with staleness

* drill that disabled

also list controls doesn't need its own songs hook/copy

* switch to react-native-blob-util for downloads

slightly slower but allows us to use DownloadManager, which backgrounds downloads so they are no longer corrupted when the app suspends

* add a fake "top songs" based on artist search

then sorted by play count/ratings
artistview should load now even if topSongs fails

* try not to swap between topSongs/search on refetch

set queueContext by song list so the index isn't off if the list changes

* add content type validation for file fetching

also try to speed up existing file return by limiting fs ops

* if the HEAD fails, don't queue the download

* clean up params

* reimpl clear image cache

* precompute contextId

prevents wrong "is playing" when any mismatch between queue and list

* clear images from all servers

use external files dir instead of cache

* fix pressable disabled flicker

don't retry topsongs on failure
try to optimize setqueue and fixcoverart a bit

* wait for queries during clear

* break out fetchExistingFile from fetchFile

allows to tell if file is coming from disk or not
only show placeholder/loading spinner if actually fetching image

* forgot these wouldn't do anything with objects

* remove query cache when switching servers

* add content-disposition extension gathering

add support for progress hook (needs native support still)

* added custom RNBU pkg with progress changes

* fully unmount tabs when server changes

prevents unwanted requests, gives fresh start on switch
fix fixCoverArt not re-rendering in certain cases on search

* use serverId from fetch deps

* fix lint

* update licenses

* just use the whole lodash package

* make using cache buster optional
This commit is contained in:
austinried
2022-04-11 09:40:51 +09:00
committed by GitHub
parent ccc7f44957
commit 335f30b0d2
48 changed files with 2205 additions and 1800 deletions
+9 -6
View File
@@ -29,14 +29,16 @@
"@react-navigation/native": "^5.9.4",
"@types/react": "^17",
"@xmldom/xmldom": "^0.7.0",
"content-disposition": "^0.5.4",
"fast-deep-equal": "^3.1.3",
"immer": "^9.0.6",
"lodash.debounce": "^4.0.8",
"lodash.merge": "^4.6.2",
"lodash.pick": "^4.4.0",
"lodash": "^4.17.21",
"md5": "^2.3.0",
"mime-types": "^2.1.35",
"path": "^0.12.7",
"react": "17.0.2",
"react-native": "0.67.1",
"react-native-blob-util": "https://github.com/austinried/react-native-blob-util.git#android-downloadmanager-progress",
"react-native-fs": "^2.18.0",
"react-native-gesture-handler": "^2.3.2",
"react-native-image-colors": "^1.3.0",
@@ -50,17 +52,18 @@
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^8.1.0",
"react-native-webview": "^11.13.0",
"react-query": "^3.34.19",
"zustand": "^3.7.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@types/content-disposition": "^0.5.4",
"@types/jest": "^26.0.23",
"@types/lodash.debounce": "^4.0.6",
"@types/lodash.merge": "^4.6.6",
"@types/lodash.pick": "^4.4.6",
"@types/lodash": "^4.14.181",
"@types/md5": "^2.3.0",
"@types/mime-types": "^2.1.1",
"@types/react-native-vector-icons": "^6.4.7",
"@types/react-test-renderer": "^16.9.2",
"babel-jest": "^26.6.3",