fix: startpage blocks now default to an array
This commit is contained in:
@@ -45,7 +45,7 @@ export default async function StartPage() {
|
|||||||
) : null}
|
) : null}
|
||||||
</header>
|
</header>
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
{(blocks || []).map((block, index) => {
|
{blocks.map((block, index) => {
|
||||||
if (block.typename === BlocksEnums.block.FullWidthCampaign) {
|
if (block.typename === BlocksEnums.block.FullWidthCampaign) {
|
||||||
return (
|
return (
|
||||||
<FullWidthCampaign
|
<FullWidthCampaign
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ export const startPageSchema = z.object({
|
|||||||
heading: z.string(),
|
heading: z.string(),
|
||||||
hero_image: tempImageVaultAssetSchema,
|
hero_image: tempImageVaultAssetSchema,
|
||||||
}),
|
}),
|
||||||
blocks: discriminatedUnionArray(blocksSchema.options).nullable(),
|
blocks: discriminatedUnionArray(blocksSchema.options)
|
||||||
|
.nullable()
|
||||||
|
.transform((val) => val || []),
|
||||||
system: systemSchema.merge(
|
system: systemSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
created_at: z.string(),
|
created_at: z.string(),
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ export const startPageQueryRouter = router({
|
|||||||
return {
|
return {
|
||||||
startPage: {
|
startPage: {
|
||||||
...startPage.data.start_page,
|
...startPage.data.start_page,
|
||||||
blocks: startPage.data.start_page.blocks?.filter((block) => {
|
blocks: startPage.data.start_page.blocks.filter((block) => {
|
||||||
if (
|
if (
|
||||||
block.typename === BlocksEnums.block.JoinScandicFriends &&
|
block.typename === BlocksEnums.block.JoinScandicFriends &&
|
||||||
session
|
session
|
||||||
|
|||||||
Reference in New Issue
Block a user