AsyncComponent

net.wiringbits.webapp.utils.slinkyUtils.components.core.AsyncComponent$

A reusable component to renders data from a asynchronous data source, providing:

  • A progress indicator when the data is being retrieved.
  • Invoking the render function when the data is available, to render such data.
  • Displaying an error message when retrieving the data has failed, as well as displaying a retry button so that the user is able to try again.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object DataState

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
DataState.type
sealed trait DataState[T] extends Product, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class Failed[T]
class Loaded[T]
class Loading[T]
case class Props[D](fetch: () => Future[D], render: D => ReactElement, onDataLoaded: D => Unit, progressIndicator: () => ReactElement, progressIndicatorWhileReloadingData: Boolean, retryLabel: String, watchedObjects: Iterable[Any])

Value parameters

fetch

the function to fetch the data

onDataLoaded

a function invoked when the remote data has been loaded

progressIndicator

the component rendered when the data is being loaded

progressIndicatorWhileReloadingData

whether to display the progress indicator every time the data is being reloaded

render

the function to render the data once it is available

retryLabel

the label to use in the button that retries the operation

watchedObjects

objects being watched, when any of those changes, the data is loaded again

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def apply[D](fetch: () => Future[D], render: D => ReactElement, onDataLoaded: D => Unit, progressIndicator: () => ReactElement, progressIndicatorWhileReloadingData: Boolean, retryLabel: String, watchedObjects: Iterable[Any]): KeyAddingStage
def component[D]: FunctionalComponent[Props[D]]

Type parameters

D

The data to fetch and render

Attributes

Returns

the component