Skip to content

scrollbox with For inside doesn't properly render content #260

Closed

Description

@istarkov

Reproduction of the issue in the opencode repo. (Will not show messages after 3s)

ref anomalyco/opencode#3819 (+ few others)
ref anomalyco/opencode#3834

the fast fix is same as there, wrapping <For with <box><For...</box>

// packages/solid/tmp.tsx
import { SyntaxStyle } from "../core/src/syntax-style"
import { render } from "./index"
import { createEffect, createMemo, createSignal, For } from "solid-js"
import type { ScrollBoxRenderable } from "../core/src/renderables"

const syntaxStyle = SyntaxStyle.fromTheme([])

const code = `

# HELLO

world

## HELLO World

\`\`\`html
<div
  class="min-h-screen bg-gradient-to-br from-amber-50 via-orange-50 to-rose-50 relative overflow-hidden"
>
  <!-- Sakura Petals Background Animation -->
  <div class="absolute inset-0 pointer-events-none">
    <div class="sakura-petal absolute top-10 left-20 animate-pulse opacity-60">
      🌸
    </div>
    <div
      class="sakura-petal absolute top-1/2 right-20 animate-pulse opacity-45"
      style="animation-delay: 1.5s"
    >
      🌸
    </div>
    <div
      class="sakura-petal absolute bottom-40 right-1/3 animate-pulse opacity-55"
      style="animation-delay: 0.5s"
    >
      🌸
    </div>
  </div>
/div>
\`\`\`


`

function ScrollFail() {
  const [count, setCount] = createSignal(0)
  const messages = createMemo(() => Array.from({ length: count() }, (_, i) => code))

  let scroll: ScrollBoxRenderable

  createEffect(() => {
    setTimeout(() => {
      setCount(100)
      setTimeout(() => {
        scroll?.scrollTo(scroll.scrollHeight)
      }, 10)
    }, 3000)
  })

  return (
    <scrollbox ref={(r) => (scroll = r)} focused stickyScroll={true} stickyStart="bottom" flexGrow={1}>
      <For each={messages()}>
        {(code) => (
          <box marginTop={2} marginBottom={2}>
            <code drawUnstyledText={false} syntaxStyle={syntaxStyle} content={code} filetype="markdown" />
          </box>
        )}
      </For>
    </scrollbox>
  )
}

render(() => (
  <box flexDirection="column" gap={1}>
    <box flexShrink={0}>
      <text>Some visual content</text>
    </box>
    <ScrollFail />
    <box flexShrink={0}>
      <text>Some visual content</text>
    </box>
  </box>
))

Activity

  1. kommander commented on Nov 3, 2025

    @kommander
    Collaborator

    @Adictya @fezproof could you help out here?

  2. self-assigned this
    on Nov 4, 2025
  3. removed their assignment
    on Nov 4, 2025
  4. istarkov commented on Nov 4, 2025

    @istarkov
    ContributorAuthor

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions