evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
3.44k stars 167 forks source link

generated tabs are broken in latest update #1972

Open fboerman opened 2 weeks ago

fboerman commented 2 weeks ago

Steps To Reproduce

generate tabs from a query like this:

<Tabs>
{#each hubs as hub}
<Tab label="{hub.hub}">

<LineChart
  data={np_combined.where(`hub = '${hub.hub}' `)}
  x=mtu
  y={["NP", "min_np", "max_np"]}
  step=true
  chartAreaHeight=300
  yFmt={`0 "MW"`}
  title="Net Position of {hub.hub} in CORE for {params.businessday} within its theoretical boundaries"
  colorPalette={amunColors}
/>

<LineChart
  data={np_util.where(`hub = '${hub.hub}' `)}
  x=mtu
  y=util_pct
  step=true
  title="Net Position of {hub.hub} in CORE for {params.businessday} as percentage of min/max"
  sort=false
  yMin=0
  yMax=1
  yFmt="pct2"
/>

</Tab>
{/each}
</Tabs>

Environment

Expected Behavior

tabs to generate with names

Actual Behaviour

tabs look like below and the content of all tabs is generated below eachother Screenshot_select-area_20240504151858

Workarounds

none that I know of so far

fboerman commented 2 weeks ago

update after talking to @hughess it probably has to do with not waiting for query result. because generating tabs in a loop like this works:

<Tabs>
{#each ['one', 'two'] as tab}
<Tab label={tab}>

  content {tab}

</Tab>
{/each}
</Tabs>
archiewood commented 2 weeks ago

Note that you should always use {#each} blocks wrapped in newlines like this

<Tabs>

{#each ['one', 'two'] as tab}

<Tab label={tab}>

  content {tab}

</Tab>

{/each}

</Tabs>

reason: markdown is newline sensitive

fboerman commented 2 weeks ago

hi @archiewood that doesnt actually fix my issue so I dont understand why you are closing this? the bug still exists

archiewood commented 2 weeks ago

Sorry, didn't mean to close, hit the wrong button on mobile

ItsMeBrianD commented 1 week ago

Should follow up post-release to confirm, but this should be addressed by the fixes in #1980

mcrascal commented 3 days ago

@ItsMeBrianD - still occurring on next afaict