Skip to content

Commit

Permalink
fix: fix period filter and loading spinner when filtering in dashboard (
Browse files Browse the repository at this point in the history
#3002)

* fix: ensure only the first period item is used

This fixes a problem when a period filter with more than 1 item is
applied in dashboard.
Passing more than 1 item to the outlier api results in an error.

* fix: enable the loading spinner when props change

This happens for example when a filter is added in dashboard which
causes the visualization object to change and triggers a re-render of
the plugin.
  • Loading branch information
edoardo authored Mar 21, 2024
1 parent fe16062 commit 8a54037
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/api/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export const getAnalyticsRequestForOutlierTable = ({
const headers = []

columns.forEach(({ dimension, items }) => {
parameters[dimension] = items.map(({ id }) => id).join(',')
// only use the first period, this accommodates for the dashboard filter scenario
parameters[dimension] =
dimension === DIMENSION_ID_PERIOD
? items[0].id
: items.map(({ id }) => id).join(',')

headers.push(forDownload ? dimension : dimensionIdHeaderMap[dimension])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const VisualizationPluginWrapper = (props) => {
[pluginProps]
)

useEffect(() => setPluginProps(props), [props])
useEffect(() => {
setIsLoading(true)
setPluginProps(props)
}, [props])

const onLoadingComplete = () => setIsLoading(false)

Expand Down

0 comments on commit 8a54037

Please sign in to comment.