Skip to content

Commit

Permalink
feat: when we have multiple sections, default to first section to avo…
Browse files Browse the repository at this point in the history
…id performance problems

this is a temporary fix untill a proper fix will be in place
  • Loading branch information
flaminic committed Nov 12, 2024
1 parent b5be111 commit f60dc2f
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export default function SectionFilterSelectorBarItem() {

useEffect(() => {
const sections = dataSet?.sections
// select first section if renderAsTabs === true
if (dataSet?.renderAsTabs && !sectionFilter && sections?.length) {
if (sectionFilter === undefined && sections?.length) {
setSectionFilter(sections[0].id)
}
// clear out section if it is invalid
Expand All @@ -55,9 +54,7 @@ export default function SectionFilterSelectorBarItem() {

const selectableOptions = dataSet?.renderAsTabs
? sectionOptions
: [{ value: undefined, label: i18n.t('All sections') }].concat(
...sectionOptions
)
: [...sectionOptions, { value: null, label: i18n.t('All sections') }]

return (
<div data-test="section-filter-selector">
Expand Down

0 comments on commit f60dc2f

Please sign in to comment.