Skip to content

Commit

Permalink
feat(dataTable): fix layer state when features are null after fetchin…
Browse files Browse the repository at this point in the history
…g #closes1823
  • Loading branch information
kaminderpal committed Feb 23, 2024
1 parent effc4e0 commit 27d6994
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/geoview-core/src/core/components/data-table/data-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
useDetailsStoreActions,
useDetailsStoreAllFeaturesDataArray,
useMapVisibleLayers,
useUIActiveFooterBarTabId,
} from '@/core/stores';
import { LayerListEntry, useFooterPanelHeight, Layout } from '../common';
import { logger } from '@/core/utils/logger';
Expand Down Expand Up @@ -45,6 +46,7 @@ export function Datapanel({ fullWidth }: DataPanelType) {
const visibleLayers = useMapVisibleLayers();
const { setSelectedLayerPath } = useDataTableStoreActions();
const { triggerGetAllFeatureInfo } = useDetailsStoreActions();
const selectedTab = useUIActiveFooterBarTabId();

// Custom hook for calculating the height of footer panel
const { tableHeight } = useFooterPanelHeight({ footerPanelTab: 'data-table' });
Expand Down Expand Up @@ -149,19 +151,16 @@ export function Datapanel({ fullWidth }: DataPanelType) {
{isLoading && <Skeleton variant="rounded" width="100%" height={400} />}

{!isLoading &&
orderedLayerData
.filter(({ features }) => !!features?.length)
.map((data) => (
<Box key={data.layerPath}>
{data.layerPath === selectedLayerPath ? (
<Box>
<DataTable data={data} layerPath={data.layerPath} tableHeight={tableHeight} />
</Box>
) : (
<Box />
)}
</Box>
))}
selectedTab === 'data-table' &&
orderedLayerData.map((data) => (
<Box key={data.layerPath}>
{data.layerPath === selectedLayerPath ? (
<DataTable data={data} layerPath={data.layerPath} tableHeight={tableHeight} />
) : (
<Box />
)}
</Box>
))}

{/* show data table instructions when all layers has no features */}
{((!isLoading && orderedLayerData.every((layers) => !layers?.features?.length)) || isLayerDisabled()) && (
Expand Down

0 comments on commit 27d6994

Please sign in to comment.