Skip to content

Commit 0eec736

Browse files
authored
Add mssing loading screen to Custom section (#3524)
1 parent dc29149 commit 0eec736

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

webview/src/plots/components/App.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ describe('App', () => {
262262
],
263263
width: DEFAULT_NB_ITEMS_PER_ROW
264264
},
265+
custom: null,
265266
hasPlots: true,
266267
hasUnselectedPlots: false,
267268
sectionCollapsed: DEFAULT_SECTION_COLLAPSED,
@@ -279,7 +280,7 @@ describe('App', () => {
279280
})
280281
const loading = await screen.findAllByText('Loading...')
281282

282-
expect(loading).toHaveLength(2)
283+
expect(loading).toHaveLength(3)
283284
})
284285

285286
it('should render the Add Plots and Add Experiments get started button when there are experiments which have plots that are all unselected', async () => {

webview/src/plots/components/customPlots/CustomPlots.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { shouldUseVirtualizedGrid } from '../util'
1515
import { PlotsState } from '../../store'
1616
import { sendMessage } from '../../../shared/vscode'
1717
import { changeOrderWithDraggedInfo } from '../../../util/array'
18+
import { LoadingSection, sectionIsLoading } from '../LoadingSection'
1819

1920
interface CustomPlotsProps {
2021
plotsIds: string[]
@@ -29,6 +30,9 @@ export const CustomPlots: React.FC<CustomPlotsProps> = ({ plotsIds }) => {
2930
const draggedRef = useSelector(
3031
(state: PlotsState) => state.dragAndDrop.draggedRef
3132
)
33+
const selectedRevisions = useSelector(
34+
(state: PlotsState) => state.webview.selectedRevisions
35+
)
3236

3337
useEffect(() => {
3438
setOrder(plotsIds)
@@ -42,6 +46,10 @@ export const CustomPlots: React.FC<CustomPlotsProps> = ({ plotsIds }) => {
4246
})
4347
}
4448

49+
if (sectionIsLoading(selectedRevisions)) {
50+
return <LoadingSection />
51+
}
52+
4553
if (!hasData) {
4654
return <EmptyState isFullScreen={false}>No Plots to Display</EmptyState>
4755
}

0 commit comments

Comments
 (0)