Skip to content

Commit

Permalink
Make View closable on errorboundary
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 14, 2022
1 parent e8cec06 commit f4e3e6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions component_tests/cgv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@jbrowse/plugin-circular-view": "file:./packed/jbrowse-plugin-circular-view.tgz",
"@jbrowse/plugin-config": "file:./packed/jbrowse-plugin-config.tgz",
"@jbrowse/plugin-data-management": "file:./packed/jbrowse-plugin-data-management.tgz",
"@jbrowse/plugin-gccontent": "file:./packed/jbrowse-plugin-gccontent.tgz",
"@jbrowse/plugin-gff3": "file:./packed/jbrowse-plugin-gff3.tgz",
"@jbrowse/plugin-linear-genome-view": "file:./packed/jbrowse-plugin-linear-genome-view.tgz",
"@jbrowse/plugin-sequence": "file:./packed/jbrowse-plugin-sequence.tgz",
Expand Down
30 changes: 16 additions & 14 deletions packages/core/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,18 @@ const ViewPanel = observer(
const { ReactComponent } = viewType
return (
<ViewContainer view={view} onClose={() => session.removeView(view)}>
<Suspense fallback={<LoadingEllipses />}>
<ReactComponent
model={view}
session={session}
getTrackType={pluginManager.getTrackType}
/>
</Suspense>
<ErrorBoundary
key={`view-${view.id}`}
FallbackComponent={({ error }) => <ErrorMessage error={error} />}
>
<Suspense fallback={<LoadingEllipses />}>
<ReactComponent
model={view}
session={session}
getTrackType={pluginManager.getTrackType}
/>
</Suspense>
</ErrorBoundary>
</ViewContainer>
)
},
Expand Down Expand Up @@ -283,14 +288,11 @@ const App = observer(
<div className={classes.components}>
{views.length ? (
views.map(view => (
<ErrorBoundary
<ViewPanel
key={`view-${view.id}`}
FallbackComponent={({ error }) => (
<ErrorMessage error={error} />
)}
>
<ViewPanel view={view} session={session} />
</ErrorBoundary>
view={view}
session={session}
/>
))
) : (
<ViewLauncher {...props} />
Expand Down

0 comments on commit f4e3e6e

Please sign in to comment.