AsyncComponent
net.wiringbits.webapp.utils.slinkyUtils.components.core.AsyncComponent$
object 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 Objecttrait Matchableclass Any
- Self type
-
AsyncComponent.type
Members list
Type members
Classlikes
object DataState
sealed trait DataState[T] extends Product, Serializable
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 Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow 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
In this article