Skip to content

Commit 8d10de4

Browse files
authored
Load main view and detail view in parallel (#521)
* Load main view and detail view in parallel * Unrelated cleanup
1 parent 0a0ea5e commit 8d10de4

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

ui/src/pages/deployment-details/deployment-details-dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ const DeploymentDetailsDialogContent = ({
5858
}) => {
5959
const [isEditing, setIsEditing] = useState(false)
6060
const { updateDeployment, isLoading, error } = useUpdateDeployment(
61-
deployment?.id
61+
deployment.id
6262
)
6363

6464
useEffect(() => {
6565
// Reset to view mode when a new deployment is selected
6666
setIsEditing(false)
67-
}, [deployment?.id])
67+
}, [deployment.id])
6868

6969
return (
7070
<>

ui/src/pages/deployments/deployments.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ export const Deployments = () => {
4242
</PageHeader>
4343
<Table
4444
items={sortedItems}
45-
isLoading={isLoading}
45+
isLoading={!id && isLoading}
4646
columns={columns(projectId as string)}
4747
sortable
4848
sortSettings={sort}
4949
onSortSettingsChange={setSort}
5050
/>
51-
{!isLoading && id ? <DeploymentDetailsDialog id={id} /> : null}
51+
{id ? <DeploymentDetailsDialog id={id} /> : null}
5252
</>
5353
)
5454
}

ui/src/pages/jobs/jobs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const Jobs = () => {
5050
</PageHeader>
5151
<Table
5252
items={jobs}
53-
isLoading={isLoading}
53+
isLoading={!id && isLoading}
5454
columns={columns(projectId as string)}
5555
sortable
5656
sortSettings={sort}
@@ -65,7 +65,7 @@ export const Jobs = () => {
6565
/>
6666
) : null}
6767
</PageFooter>
68-
{!isLoading && id ? <JobDetailsDialog id={id} /> : null}
68+
{id ? <JobDetailsDialog id={id} /> : null}
6969
</>
7070
)
7171
}

ui/src/pages/occurrences/occurrences.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const Occurrences = () => {
100100
{selectedView === 'table' && (
101101
<Table
102102
items={occurrences}
103-
isLoading={isLoading}
103+
isLoading={!id && isLoading}
104104
columns={columns(
105105
projectId as string,
106106
selectedItems.length === 0
@@ -115,7 +115,10 @@ export const Occurrences = () => {
115115
)}
116116
{selectedView === 'gallery' && (
117117
<div className={styles.galleryContent}>
118-
<OccurrenceGallery occurrences={occurrences} isLoading={isLoading} />
118+
<OccurrenceGallery
119+
occurrences={occurrences}
120+
isLoading={!id && isLoading}
121+
/>
119122
</div>
120123
)}
121124
<PageFooter>
@@ -141,7 +144,7 @@ export const Occurrences = () => {
141144
/>
142145
) : null}
143146
</PageFooter>
144-
{!isLoading && id ? <OccurrenceDetailsDialog id={id} /> : null}
147+
{id ? <OccurrenceDetailsDialog id={id} /> : null}
145148
</>
146149
)
147150
}

ui/src/pages/species-details/species-details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const SpeciesDetails = ({ species }: { species: Species }) => {
2121
const blueprintItems = useMemo(
2222
() =>
2323
species.occurrences.length
24-
? species?.occurrences
24+
? species.occurrences
2525
.map((id) => species.getOccurrenceInfo(id))
2626
.filter((item): item is BlueprintItem => !!item)
2727
.map((item) => ({

ui/src/pages/species/species.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const Species = () => {
7171
{selectedView === 'table' && (
7272
<Table
7373
items={species}
74-
isLoading={isLoading}
74+
isLoading={!id && isLoading}
7575
columns={columns(projectId as string)}
7676
sortable
7777
sortSettings={sort}
@@ -80,7 +80,7 @@ export const Species = () => {
8080
)}
8181
{selectedView === 'gallery' && (
8282
<div className={styles.galleryContent}>
83-
<SpeciesGallery species={species} isLoading={isLoading} />
83+
<SpeciesGallery species={species} isLoading={!id && isLoading} />
8484
</div>
8585
)}
8686
<PageFooter>
@@ -92,7 +92,7 @@ export const Species = () => {
9292
/>
9393
) : null}
9494
</PageFooter>
95-
{!isLoading && id ? <SpeciesDetailsDialog id={id} /> : null}
95+
{id ? <SpeciesDetailsDialog id={id} /> : null}
9696
</>
9797
)
9898
}

0 commit comments

Comments
 (0)