forte-music / web

A web interface for forte.
Other
2 stars 1 forks source link

Refactor PlaybackArtworkContainer #54

Open 0xcaff opened 6 years ago

0xcaff commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

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/