Experimental home: accommodate old saved sections.

This commit is contained in:
James Grugett 2022-09-12 11:56:15 -05:00
parent 5c6328ffc2
commit 4f19220778

View File

@ -7,7 +7,7 @@ import { Row } from 'web/components/layout/row'
import { Subtitle } from 'web/components/subtitle' import { Subtitle } from 'web/components/subtitle'
import { useMemberGroups } from 'web/hooks/use-group' import { useMemberGroups } from 'web/hooks/use-group'
import { filterDefined } from 'common/util/array' import { filterDefined } from 'common/util/array'
import { keyBy } from 'lodash' import { isArray, keyBy } from 'lodash'
import { User } from 'common/user' import { User } from 'common/user'
import { Group } from 'common/group' import { Group } from 'common/group'
@ -107,6 +107,9 @@ const SectionItem = (props: {
} }
export const getHomeItems = (groups: Group[], sections: string[]) => { export const getHomeItems = (groups: Group[], sections: string[]) => {
// Accommodate old home sections.
if (!isArray(sections)) sections = []
const items = [ const items = [
{ label: 'Daily movers', id: 'daily-movers' }, { label: 'Daily movers', id: 'daily-movers' },
{ label: 'Trending', id: 'score' }, { label: 'Trending', id: 'score' },