You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the spotify player is controlled via React Context, and should solely be responsible for communicating with Spotify's web player SDK. When trying to get information about the queue (list of next tracks), those should be accessible via a redux store.
For an explanation of terms and what each file does, read more from our wiki: Working With Redux.
Interface
When someone else needs access to the tracks, their code should look like this:
// SomeComponent.tsxexportconstSomeComponent=()=>{// All tracks after currentconstnextTracks: Track[]=useSelector(selectNextTracks)// Just current track, or nullconstcurrentTrack: Track|null=useSelector(selectCurrentTrack)// Array containing current track and next tracks, if applicableconstallTracks: Track[]=useSelector(selectTracksQueue)return<div>...</div>}
Note: The current track should be accessible from either the player context, or tracks store. Both should return the same information. However, the player context is the source of truth for the current track, and the redux store just references whatever is in the context state.
Tasks
Create tasks store
Create current track selector
Create next tracks selector (returns tracks AFTER current track)
Create tracks queue selector (returns current track and next tracks)
Create thunk for fetching tracks queue (this will connect to network, just return empty array for now)
Create action for activating fetch tracks queue thunk (the thunk is not directly used, but is wrapped in an action)
Next Steps
This will eventually be one of the primary arteries in the application, and will coordinate updates to and from the server. Future tasks will involve linking this state to the server via the webhook and sharing information back and forth to create a continuous flow of information.
The text was updated successfully, but these errors were encountered:
Intro
Currently, the spotify player is controlled via React Context, and should solely be responsible for communicating with Spotify's web player SDK. When trying to get information about the queue (list of next tracks), those should be accessible via a redux store.
Spec
Structure
The store should look like this:
For an explanation of terms and what each file does, read more from our wiki: Working With Redux.
Interface
When someone else needs access to the tracks, their code should look like this:
Note: The current track should be accessible from either the player context, or tracks store. Both should return the same information. However, the player context is the source of truth for the current track, and the redux store just references whatever is in the context state.
Tasks
Next Steps
This will eventually be one of the primary arteries in the application, and will coordinate updates to and from the server. Future tasks will involve linking this state to the server via the webhook and sharing information back and forth to create a continuous flow of information.
The text was updated successfully, but these errors were encountered: