[Content]: misleading section about when derived-signals are called
还没有人认领这个 Issue。
- 主要语言
- MDX
- 星标
- 292
- 派生
- 361
- 平均合并
- 7 小时 51 分钟
- 30 天内合并 PR
- 1
描述
📚 Subject area/topic
concepts/derived-values/derived-signals
📋 Page(s) affected (or suggested, for new content)
https://docs.solidjs.com/concepts/derived-values/derived-signals
📋 Description of content that is out-of-date or incorrect
These functions are not executed immediately, but instead are only called when the values they rely on are changed. When the underlying signal is changed, the function will be called again to produce a new value.
I'm beginning with solidjs, so maybe I got this wrong, but I think this is at least misleading.
It is not called when count() changed (click "call inc").
It is only called, if it is explicitly called (in the example click "call double") or if it is used in a reactive context (uncomment {/*<div>double: {double()}</div>*/})
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
import { render } from "solid-js/web";
import { createSignal } from "solid-js";
function App() {
const [count, setCount] = createSignal(0);
const inc = () => setCount(count() + 1)
const double = () => {console.log("double called"); return count() * 2}
return (
<div>
<div>count: {count()}</div>
{/*<div>double: {double()}</div>*/}
<button onClick={() => inc()}>call inc</button>
<button onClick={() => double()}>call double</button>
</div>
);
}
render(() => <App />, document.getElementById('app'));
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中链接的 derived-signals 文档页面开始,将其中引用的解释与提供的 SolidJS 复现进行比较。更新措辞,使其准确描述函数何时运行,然后验证文档中的示例及其产生的行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100