Skip to content

Commit

Permalink
[Class statistics] Fix courses stats not being fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
valtterikantanen committed Sep 9, 2024
1 parent f7e4575 commit 656f199
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const PopulationDetails = ({
/>
</div>
),
alwaysRender: true,
},
]

Expand Down
7 changes: 4 additions & 3 deletions services/frontend/src/components/common/PanelView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { useLocalStorage } from '@/common/hooks'
const titleStyle = { paddingTop: '1vh', paddingBottom: '1vh', color: 'black', fontSize: 'large' }

/*
Takes in list of objects with properties: title (string), content (jsx)
Takes in list of objects with properties: title (string), content (jsx), and optionally alwaysRender (boolean)
e.g.
[ { title: 'Credit accumulation', content: <>stuff</> },
[ { title: 'Credit accumulation', content: <>stuff</>, alwaysRender: true },
... ]
falsy items are filtered out, so you can leave them in
Always rendering the panel might be necessary for example when the data needed in the parent component will be fetched inside the panel. Note that rendering doesn't mean that the content is visible, it's just rendered in the DOM.
*/
export const PanelView = ({ panels: initialPanels, viewTitle }) => {
const refs = useRef([])
Expand Down Expand Up @@ -47,7 +48,7 @@ export const PanelView = ({ panels: initialPanels, viewTitle }) => {
),
},
content: {
content: activeIndex.includes(index) && (
content: (activeIndex.includes(index) || panel.alwaysRender) && (
<div
key={panel.key}
ref={element => {
Expand Down

0 comments on commit 656f199

Please sign in to comment.