diff --git a/CHANGELOG.md b/CHANGELOG.md index e6c57eed0..ccd0de293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,26 @@ You can also check the [release page](https://github.com/visualize-admin/visuali ## Unreleased +Nothing yet. + +# [3.22.9] - 2023-10-06 + +- Fixes + - Cascading filters are not stuck anymore in the loading mode in some cases +- Maintenance + - GQL debug panel now includes queries fired through SPARQLClientStream (e.g. hierarchies) and CONSTRUCT queries + - Configurator and interactive filters debug panel is now displayed if `flag__debug` is set to true +- Docs + - Added chart preview via API section to the documentation + +# [3.22.8] - 2023-09-29 + - Fixes - Cube checker now correctly checks if dimensions are present + - It's now possible to change the chart type for copied, non-hierarchical charts without having to open an options panel first + - Interactive filters are now aligned correctly (y axis) +- Performance + - Dataset preview should now load quicker as we no longer fetch dimension values along with it # [3.22.6] - 2023-09-19 diff --git a/app/charts/shared/chart-data-filters.tsx b/app/charts/shared/chart-data-filters.tsx index fcf5518a0..e019534e9 100644 --- a/app/charts/shared/chart-data-filters.tsx +++ b/app/charts/shared/chart-data-filters.tsx @@ -48,6 +48,7 @@ import { useInteractiveFiltersRaw, } from "@/stores/interactive-filters"; import { hierarchyToOptions } from "@/utils/hierarchy"; +import useEvent from "@/utils/use-event"; type ChartDataFiltersProps = { dataSet: string; @@ -227,11 +228,11 @@ const DataFilter = (props: DataFilterProps) => { const dimension = data?.dataCubeByIri?.dimensionByIri; const hierarchy = data?.dataCubeByIri?.dimensionByIri?.hierarchy; - const setDataFilter = ( - e: SelectChangeEvent | { target: { value: string } } - ) => { - updateDataFilter(dimensionIri, e.target.value as string); - }; + const setDataFilter = useEvent( + (e: SelectChangeEvent | { target: { value: string } }) => { + updateDataFilter(dimensionIri, e.target.value as string); + } + ); const configFilter = dimension ? chartConfig.filters[dimension.iri] @@ -263,9 +264,9 @@ const DataFilter = (props: DataFilterProps) => { dimension?.values, dimensionIri, fetching, - updateDataFilter, - // Also reload when the config value changes. + setDataFilter, configFilterValue, + updateDataFilter, ]); return dimension ? ( @@ -603,7 +604,7 @@ const useEnsurePossibleInteractiveFilters = ( // We need to get the values dynamically, as they can get updated by // useSyncInteractiveFilters and this callback runs with old value. - const dataFilters = IFRaw.getState().dataFilters; + const dataFilters = { ...IFRaw.getState().dataFilters }; if (!isEqual(filters, interactiveFilters) && !isEmpty(filters)) { for (const [k, v] of Object.entries(filters)) { diff --git a/app/components/debug-panel/DebugPanel.tsx b/app/components/debug-panel/DebugPanel.tsx index 48340437b..f3b010e0c 100644 --- a/app/components/debug-panel/DebugPanel.tsx +++ b/app/components/debug-panel/DebugPanel.tsx @@ -166,13 +166,14 @@ DESCRIBE <${configuratorState.dataSet ?? ""}>` ); }; -const DebugPanel = ({ - configurator = false, - interactiveFilters = false, -}: { +export type DebugPanelProps = { configurator?: Boolean; interactiveFilters?: Boolean; -}) => { +}; + +const DebugPanel = (props: DebugPanelProps) => { + const { configurator = false, interactiveFilters = false } = props; + return ( null; - -const ExportedDebugPanel = - process.env.NODE_ENV === "development" ? DebugPanel : DebugPanelNull; - -export default ExportedDebugPanel; +export default DebugPanel; diff --git a/app/components/debug-panel/index.tsx b/app/components/debug-panel/index.tsx index 32a1cf1ce..944dfbc65 100644 --- a/app/components/debug-panel/index.tsx +++ b/app/components/debug-panel/index.tsx @@ -2,12 +2,24 @@ import { CircularProgress } from "@mui/material"; import dynamic from "next/dynamic"; import { Suspense } from "react"; -const LazyDebugPanel = dynamic(() => import("./DebugPanel")); - -export default process.env.NODE_ENV === "development" - ? (props: React.ComponentProps) => ( - }> - - - ) - : () => null; +import { flag } from "@/flags"; + +import { DebugPanelProps } from "./DebugPanel"; + +const LazyDebugPanel = dynamic(() => import("./DebugPanel"), { ssr: false }); + +const DebugPanel = (props: DebugPanelProps) => { + const shouldShow = flag("debug") || process.env.NODE_ENV === "development"; + + if (!shouldShow) { + return null; + } + + return ( + }> + + + ); +}; + +export default DebugPanel; diff --git a/app/components/select-tree.tsx b/app/components/select-tree.tsx index a2538bc4b..7aa454776 100644 --- a/app/components/select-tree.tsx +++ b/app/components/select-tree.tsx @@ -481,7 +481,7 @@ function SelectTree({ return (
{label && ( -