fastn icon indicating copy to clipboard operation
fastn copied to clipboard

optional <record-type> <name>: is not working

Open Arpita-Jaiswal opened this issue 1 year ago • 0 comments

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:

  1. optional ds.gap spacing:
  2. 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.

Arpita-Jaiswal avatar Dec 07 '23 10:12 Arpita-Jaiswal