This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* nativefy remixes screen * fix errors * fix type errors again? * fix type errors again again Co-authored-by: Nikki Kang <kangaroo233@gmail.com>
- Loading branch information
Showing
8 changed files
with
103 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { TrackMetadata, remixesPageActions, Track } from '@audius/common' | ||
import { takeEvery, call, put } from 'redux-saga/effects' | ||
|
||
import { waitForBackendSetup } from 'common/store/backend/sagas' | ||
import { | ||
retrieveTrackByHandleAndSlug, | ||
retrieveTracks | ||
} from 'common/store/cache/tracks/utils/retrieveTracks' | ||
|
||
import tracksSagas from './lineups/tracks/sagas' | ||
|
||
const { fetchTrack, fetchTrackSucceeded } = remixesPageActions | ||
|
||
function* watchFetch() { | ||
yield takeEvery( | ||
fetchTrack.type, | ||
function* (action: ReturnType<typeof fetchTrack>) { | ||
yield call(waitForBackendSetup) | ||
const { handle, slug, id } = action.payload | ||
if (!id && (!handle || !slug)) { | ||
throw new Error( | ||
'Programming error - fetch tracks action for remixes page requires either `id` or both `handle` and `slug` params in the payload.' | ||
) | ||
} | ||
let track: TrackMetadata | Track | ||
if (id) { | ||
// @ts-ignore - TS complains about the generator lacking a return type annotation | ||
const res = yield call(retrieveTracks, { trackIds: [id] }) | ||
track = res[0] | ||
} else { | ||
if (!handle || !slug) return // This line not needed, but is here to appease typescript | ||
track = yield call(retrieveTrackByHandleAndSlug, { | ||
handle, | ||
slug | ||
}) | ||
} | ||
|
||
// TODO: The track could potentially be null or undefined - should have a way to deal with that. | ||
yield put(fetchTrackSucceeded({ trackId: track.track_id })) | ||
} | ||
) | ||
} | ||
|
||
export default function sagas() { | ||
return [...tracksSagas(), watchFetch] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters