fastn
fastn copied to clipboard
optional <record-type> <name>: is not working
Check this commit: https://github.com/fastn-community/design-system/commit/8b76f940e1d32e298627c1a0231f111d871eab1b
-- section-grid:
-- component section-grid:
module design-system: ds
integer flush: $hack-flush-to-header
children content:
optional ds.gap spacing:
-- ftd.column:
width: fill-container
align-content: center
-- ftd.row:
width if { section-grid.flush == hack-flush-full }: fill-container
max-width.fixed if { section-grid.flush == hack-flush-narrow }: $inherited.widths.narrow
max-width.fixed if { section-grid.flush == hack-flush-wide }: $inherited.widths.wide
max-width.fixed: $inherited.widths.regular
children: $section-grid.content
align-content: center
spacing if { section-grid.spacing != NULL && section-grid.spacing.gap == hack.SPACE-BETWEEN-MAGIC-NUMBER }: space-between
spacing.fixed.px if { section-grid.spacing != NULL }: $section-grid.spacing.gap
-- end: ftd.row
-- end: ftd.column
-- end: section-grid
The following line breaks the code:
- optional ds.gap spacing:
- spacing if { section-grid.spacing != NULL && section-grid.spacing.gap == hack.SPACE-BETWEEN-MAGIC-NUMBER }
Console shows the following error in ssr
:
called `Result::unwrap()` on an `Err` value: Exception(String("TypeError: cannot read property 'get' of null"))
The ssr tries to access gap
field (section-grid.spacing.gap
) which is the second condition even when the first condition (section-grid.spacing != NULL
) is false.