Skip to content

Commit

Permalink
feat: Show error if there is an error
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Nov 2, 2022
1 parent fdcb09c commit 2030cb2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/configurator/components/chart-configurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Menu,
MenuItem,
Theme,
Typography,
} from "@mui/material";
import { makeStyles } from "@mui/styles";
import { ascending } from "d3";
Expand Down Expand Up @@ -229,6 +230,7 @@ const useEnsurePossibleFilters = ({
.toPromise();
if (error || !data) {
setError(error);
setFetching(false);
console.warn("Could not fetch possible filters", error);
return;
}
Expand Down Expand Up @@ -516,9 +518,10 @@ export const ChartConfigurator = ({
} = useFilterReorder({
onAddDimensionFilter: () => closeFilterMenu(),
});
const { fetching: possibleFiltersFetching } = useEnsurePossibleFilters({
state,
});
const { fetching: possibleFiltersFetching, error: possibleFiltersError } =
useEnsurePossibleFilters({
state,
});
const fetching = possibleFiltersFetching || dataFetching;

const filterMenuButtonRef = useRef(null);
Expand Down Expand Up @@ -577,6 +580,11 @@ export const ChartConfigurator = ({
aria-labelledby="controls-data"
data-testid="configurator-filters"
>
{possibleFiltersError ? (
<Typography variant="body2" color="error">
{possibleFiltersError.message}
</Typography>
) : null}
<DragDropContext onDragEnd={handleDragEnd}>
<Droppable droppableId="filters">
{(provided) => (
Expand Down

0 comments on commit 2030cb2

Please sign in to comment.