Skip to content

Commit

Permalink
fix: handle multiple periods in interpretations
Browse files Browse the repository at this point in the history
  • Loading branch information
BRaimbault committed Dec 13, 2024
1 parent 051a9bd commit 5d7c55d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/interpretations/InterpretationMap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import React, { useState, useEffect } from 'react'
import useBasemapConfig from '../../hooks/useBasemapConfig.js'
import { getPeriodFromFilters } from '../../util/analytics.js'
import { getPeriodsFromFilters } from '../../util/analytics.js'
import { getRelativePeriods } from '../../util/periods.js'
import Map from '../plugin/Map.js'
import styles from './styles/InterpretationMap.module.css'
Expand All @@ -14,10 +14,12 @@ const InterpretationMap = ({ visualization, filters, onResponsesReceived }) => {
// Find layers with relative periods
const relativePeriodLayers = visualization.mapViews
.filter((config) => {
const period = getPeriodFromFilters(config.filters)
const periods = getPeriodsFromFilters(config.filters)
return (
period &&
getRelativePeriods().find((p) => p.id === period.id)
periods &&
periods.some((period) =>
getRelativePeriods().some((p) => p.id === period.id)
)
)
})
.map((layer) => ({
Expand Down

0 comments on commit 5d7c55d

Please sign in to comment.