Skip to content

fix(fresh-ui): registry ChartBlock + Toast fail deno lint/check when copied into a Deno app #206

Description

@rickylabs

Summary

Two @netscript/fresh-ui registry components ship source that fails deno lint / deno check the moment they're copied into a standard Deno Fresh app via ui:add / ui:init (alpha.18). Both block deno task check immediately, so every consumer must hand-patch copy-source files (which then get clobbered on the next ui:init --force). Fixing upstream makes them permanent.

Repro: netscript ui:init --force + netscript ui:add ai into a Deno app, then deno lint . && deno check.

1 · registry/components/ui/chart-block.tsxjsx-key (3 unkeyed list renders, column variant)

error[jsx-key]: Missing 'key' prop for an element
  chart-block.tsx:70  {ticks.map((tick) => <span class='ns-colchart__ytick'>…)}
  chart-block.tsx:73  {data.map((datum) => <div class='ns-colchart__col'>…)}
  chart-block.tsx:87  {data.map((datum) => <span>{datum.label}</span>)}

Fix: add key (index is fine) to each mapped element, e.g. data.map((datum, i) => <span key={i}>….

2 · registry/islands/ui/toast.tsx (Toast) — setTimeout ref type (TS2322)

TS2322: Type 'Timeout' is not assignable to type 'number'.
  toast.tsx  exitTimeoutRef.current = globalThis.setTimeout(…)   (useRef<number>())

Under Deno with Node types in scope, globalThis.setTimeout returns Timeout, not number. The three timeout refs are declared useRef<number>().
Fix: useRef<ReturnType<typeof setTimeout>>() for exitTimeoutRef / hideTimeoutRef / urlCleanupTimeoutRef (leave the two genuine numeric refs).

Context

Found while adopting fresh-ui@0.0.1-alpha.18 in eis-chat (rickylabs/eis-chat#28/#29). Patched locally as copy-source for now; filing so the registry source is fixed permanently. Both are trivial, mechanical fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions