From e8cec06a82cda2d73c106f55f3d77212b2ba007d Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 8 Nov 2022 12:46:49 -0700 Subject: [PATCH 1/2] Move ErrorBoundary so that track label still available to close track --- .../components/LinearGenomeView.tsx | 12 +--- .../components/TrackContainer.tsx | 58 +++++++++++-------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/plugins/linear-genome-view/src/LinearGenomeView/components/LinearGenomeView.tsx b/plugins/linear-genome-view/src/LinearGenomeView/components/LinearGenomeView.tsx index 0a05752f5b..c94362f5b9 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/components/LinearGenomeView.tsx +++ b/plugins/linear-genome-view/src/LinearGenomeView/components/LinearGenomeView.tsx @@ -1,9 +1,8 @@ import React from 'react' import { Button, Paper, Typography } from '@mui/material' import { makeStyles } from 'tss-react/mui' -import { ErrorBoundary } from 'react-error-boundary' import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons' -import { LoadingEllipses, ErrorMessage } from '@jbrowse/core/ui' +import { LoadingEllipses } from '@jbrowse/core/ui' import { observer } from 'mobx-react' // locals @@ -75,14 +74,7 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => { )} ) : ( - tracks.map(track => ( - } - > - - - )) + tracks.map(track => ) )} diff --git a/plugins/linear-genome-view/src/LinearGenomeView/components/TrackContainer.tsx b/plugins/linear-genome-view/src/LinearGenomeView/components/TrackContainer.tsx index 999ed02c30..39283b36d4 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/components/TrackContainer.tsx +++ b/plugins/linear-genome-view/src/LinearGenomeView/components/TrackContainer.tsx @@ -5,7 +5,8 @@ import { observer } from 'mobx-react' import { isAlive } from 'mobx-state-tree' import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models' import { getConf } from '@jbrowse/core/configuration' -import { ResizeHandle } from '@jbrowse/core/ui' +import { ResizeHandle, ErrorMessage } from '@jbrowse/core/ui' +import { ErrorBoundary } from 'react-error-boundary' import { useDebouncedCallback } from '@jbrowse/core/util' // locals @@ -109,36 +110,43 @@ function TrackContainer({ return ( -
display.setScrollTop(event.currentTarget.scrollTop)} - onDragEnter={debouncedOnDragEnter} - data-testid={`trackRenderingContainer-${model.id}-${trackId}`} + } >
+ display.setScrollTop(event.currentTarget.scrollTop) + } + onDragEnter={debouncedOnDragEnter} + data-testid={`trackRenderingContainer-${model.id}-${trackId}`} > - -
- - {DisplayBlurb ? (
- +
- ) : null} -
+ + {DisplayBlurb ? ( +
+ +
+ ) : null} + +
Date: Fri, 11 Nov 2022 10:28:52 -0700 Subject: [PATCH 2/2] Make View closable on errorboundary --- packages/core/ui/App.tsx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/core/ui/App.tsx b/packages/core/ui/App.tsx index a6a9855d45..7333a12344 100644 --- a/packages/core/ui/App.tsx +++ b/packages/core/ui/App.tsx @@ -209,13 +209,18 @@ const ViewPanel = observer( const { ReactComponent } = viewType return ( session.removeView(view)}> - }> - - + } + > + }> + + + ) }, @@ -283,14 +288,11 @@ const App = observer(
{views.length ? ( views.map(view => ( - ( - - )} - > - - + view={view} + session={session} + /> )) ) : (