Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Refactor PlaybackArtworkContainer #54

Open
0xcaff opened this issue Aug 6, 2018 · 2 comments
Open

Refactor PlaybackArtworkContainer #54

0xcaff opened this issue Aug 6, 2018 · 2 comments

Comments

@0xcaff
Copy link
Member

0xcaff commented Aug 6, 2018

Currently PlaybackArtworkContainer is a PlaybackArtwork wrapped with a redux enhancer. Its only usage is inside a PlaybackAlbumArtwork.

Problems

  1. It synchronously builds a list of tracks to enqueue. Ideally the tracks are fetched based on the album id asynchronously so all songs of an album don't need to be pre-loaded.
  2. It pays the cost of being de-coupled from PlaybackAlbumArtwork without any benefits.
@0xcaff
Copy link
Member Author

0xcaff commented Aug 28, 2018

Started working on this. You can see work in refactor/playback.

PlaybackArtworkContainer will be useful when creating PlaybackArtistArtwork. (#7)

Some additional problems we need to consider:

  1. Figure out loading when already loading. If something is already loading and another loading is started, the first loading should be cancelled (or at least its result should be ignored).

  2. Dynamic loading is possible, but it isn't used anywhere. Use it.

  3. It doesn't look like PlaybackArtwork handles rendering a loading animation.

@0xcaff
Copy link
Member Author

0xcaff commented Sep 1, 2018

So I've thought about how to solve 1.

Each instance of PlaybackArtworkContainer will have an identifier.

State

The state will hold the currently loading item's instance identifier.

Actions

  • Start Loading
    The start loading action will be dispatched when loading has been started. It will have the instance identifier of the PlaybackArtworkContainer. Updates the currently loading item's instance identifier.

  • Done Loading
    The done loading action will be dispatched when loading has completed or failed. If for the last loading item's instance identifier, set the loading state to not loading. It will also have an action which will be dispatched if the id passed in the action is the same as the currently loading item.

UI

The queue won't change until loading is complete. Nothing needs to be changed with the UI. The loading animation (2) could be the ripple effect from spinkit. http://tobiasahlin.com/spinkit/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant