Closed cmdcolin closed 5 years ago
Right now loading and error states are part of the block, see the block MST models
On Tue, Apr 16, 2019 at 1:09 PM Colin Diesh notifications@github.com wrote:
A track should probably be able to set a loading and/or error state on the model and have the track automatically make a message from it
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse-components/issues/251, or mute the thread https://github.com/notifications/unsubscribe-auth/AAASAFKWUK24TSJ7RAUBSBLPQYXA3ANCNFSM4HGOOFRA .
I was considering something like this to set it via the track level
diff --git a/packages/jbrowse-web/src/plugins/LinearGenomeView/models/blockBasedTrack.js b/packages/jbrowse-web/src/plugins/LinearGenomeView
/models/blockBasedTrack.js
index 6178b1d..ad6b855 100644
--- a/packages/jbrowse-web/src/plugins/LinearGenomeView/models/blockBasedTrack.js
+++ b/packages/jbrowse-web/src/plugins/LinearGenomeView/models/blockBasedTrack.js
@@ -93,6 +93,16 @@ export default types.compose(
}),
)
},
+ setError(error) {
+ self.blockState.forEach(value => {
+ value.setError(error)
+ })
+ },
+ setLoading() {
+ self.blockState.forEach(value => {
+ value.setLoading()
+ })
+ },
deleteBlock(key) {
The right approach would probably be to add states for this to the track MST models, and to alter BlockBasedTrack.js to not call <TrackBlocks>
if there is a track message or a track error.
The track message support was already implemented in https://github.com/GMOD/jbrowse-components/commit/59de2319934a91275c397c59f2eaa69f103a79b0, but we still need track errors.
If we set track.error on the mst model, then the error state is handled properly now following #326
If I misunderstand let me know but things like 404 and other errors are given a simple message
A track should probably be able to set a loading and/or error state on the model and have the track automatically make a message from it