mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
* refactor(ui): route direct httpClient calls through the dataProvider
Components called httpClient directly for the Last.fm and ListenBrainz
links, plugin rescan, image upload and delete, playlist tracks and M3U
export. Those calls are now named wrapperDataProvider methods used through
useDataProvider(), next to the existing custom ones. The
getTranscodeDecision call moved into src/subsonic with the other Subsonic
calls, and src/transcode/fetchDecision.js is gone. URLs, methods, headers
and bodies are unchanged.
A no-restricted-imports rule now rejects httpClient imports outside
src/dataProvider and src/subsonic, and its message names where the call
should go.
* refactor(ui): share the JSON response wrapper in dataProvider custom methods
Extract a fetchData helper for the repeated httpClient(...).then(({ json }) => ({ data: json }))
in wrapperDataProvider custom methods, including the ones that predate this branch. URLs,
methods, headers and bodies are unchanged.
* fix(ui): keep moved dataProvider calls out of the optimistic queue
While an undoable mutation is pending (removing playlist tracks, saving a
playlist edit), react-admin's useDataProvider queues every call and resolves
it with no result. On a 401 it also resolves with nothing instead of
rejecting. The calls moved off httpClient in this branch went through that
proxy, so Export M3U failed, the duplicate check in Add to playlist showed an
error, and image upload could report success after a failure.
Add useDirectDataProvider, which returns the raw dataProvider from
DataProviderContext, and use it for those calls. They now behave as they did
when they called httpClient directly.
8 lines
239 B
JavaScript
8 lines
239 B
JavaScript
import { createDecisionService } from './decisionService'
|
|
import subsonic from '../subsonic'
|
|
export { detectBrowserProfile } from './browserProfile'
|
|
|
|
export const decisionService = createDecisionService(
|
|
subsonic.getTranscodeDecision,
|
|
)
|