Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Fix lineup types in mobile build (#1812)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers committed Aug 29, 2022
1 parent 27cf13a commit 6f24724
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function* retrieveTrackByHandleAndSlug({
withRemixParents
}: RetrieveTrackByHandleAndSlugArgs) {
const permalink = `/${handle}/${slug}`
const tracks: { entries: { [permalink: string]: Track } } = yield* call(
const tracks = (yield* call(
// @ts-ignore retrieve should be refactored to ts first
retrieve,
{
Expand Down Expand Up @@ -111,7 +111,8 @@ export function* retrieveTrackByHandleAndSlug({
return tracks.map((track) => reformat(track, audiusBackendInstance))
}
}
)
)) as { entries: { [permalink: string]: Track } }

const track = tracks.entries[permalink]
if (!track || !track.track_id) return null
const trackId = track.track_id
Expand Down
29 changes: 29 additions & 0 deletions packages/web/src/common/store/lineup/sagas.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
Collection,
LineupBaseActions,
LineupState,
LineupTrack
} from '@audius/common'

export class LineupSagas {
constructor(
prefix: string,
actions: LineupBaseActions,
feedSelector: (store: any) => LineupState<any>,
getTracks: (config: {
offset: number
limit: number
payload: any
}) => Generator<any, any[], any>,
retainSelector?: (entry: (LineupTrack | Collection) & { uid: string }) => {
uid: string
kind: string
id: number
activityTimestamp: string | undefined
},
removeDeleted?: boolean,
sourceSelector?: (state: any) => string
): void

getSagas(): any[]
}
5 changes: 3 additions & 2 deletions packages/web/src/common/store/player/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
getContext,
actionChannelDispatcher,
playerActions,
playerSelectors
playerSelectors,
Nullable
} from '@audius/common'
import { eventChannel } from 'redux-saga'
import {
Expand Down Expand Up @@ -305,7 +306,7 @@ function* recordListenWorker() {
// Store the last seen play counter to make sure we only record
// a listen for each "unique" track play. Using an id here wouldn't
// be enough because the user might have "repeat single" mode turned on.
let lastSeenPlayCounter = null
let lastSeenPlayCounter: Nullable<number> = null
while (true) {
const trackId = yield* select(getTrackId)
const playCounter = yield* select(getCounter)
Expand Down

0 comments on commit 6f24724

Please sign in to comment.