Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Optimistically mounted component appears before its dynamic style is applied

已关闭
#3,835 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
frontend

调研方向

Start from the optimistic mounting and memo implementation in the rendering pipeline. The issue involves createMemo and style application during optimistic renders. Use the playground reproduction to verify the behavior. The fix should ensure the component either waits for styles before mounting or uses the committed signal value for the initial render.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

An optimistically mounted component reveals its static text before applying its dynamic style.

The component returns a memo containing an element whose color is always either red or blue. Its style and an inner conditional read the same non-optimistic signal. While an action holds that signal's update, clicking Run reveals <div>Hello</div> with no style attribute. After two seconds it becomes <div style="color: blue;">Hello world</div>.

The issue is the unstyled intermediate element, not that the blue update waits for the action.

Your Example Website or App

https://s.olid.uk/id/cu5JVqDbSkWlmoERReb30Q

Steps to Reproduce the Bug or Issue
  1. Open the playground and click Run once.
  2. During the two-second action, observe that Hello appears in the default black color. Inspecting its element shows no style attribute.
  3. When the action finishes, the text becomes Hello world and the blue style is applied.
Expected behavior

Either keep the child held until it can render consistently, or reveal it using the committed signal value (false, so red). Revealing the element without either declared color is inconsistent.

Screenshots or Videos

No response

Platform
  • OS: Linux (WSL)
  • Browser: Chromium 153.0.8010.12
  • Solid: preview build 3ab71b0 (solid-js, @solidjs/web, and @solidjs/signals)
Additional context

Removing the component's createMemo wrapper or replacing its inner conditional text with static text avoids the unstyled intermediate element. The repro uses only signals, an optimistic signal, an action, and a real timer; Tailwind is disabled.

主要语言
TypeScript
星标
36.1k
派生
1.1k
平均合并
11 小时 42 分钟
30 天内合并 PR
326

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

solidjs/solid 的其他 Issue

查看 solidjs/solid 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。