Convert ngOnInit input reads to computed() for full signal reactivity
维护者通常 5 天内回复
@bracyw 已经在做这个了。
开始于 2026年3月29日。
评估
这个 Issue 还没有评估数据。
描述
Description
Several components read @Input() values inside ngOnInit to derive local state. This breaks signal reactivity -- if the parent updates the input after init, the derived values go stale.
Migrate these components to use the input() signal function and computed() for derived state so values stay reactive. Remove ngOnInit from components where it only existed to compute derived input state.
Example
circular-percentage.component.ts reads this.dimension in ngOnInit to compute sizing values:
// Before
@Input() dimension!: number;
innerCircleDimension: number = 0;
ngOnInit() {
this.innerCircleDimension = this.dimension * 0.87;
}
// After
dimension = input.required<number>();
innerCircleDimension = computed(() => this.dimension() * 0.87);
Affected Components
- SwitchComponent (
src/components/switch/switch.component.ts) --chargingStringderived fromisOn,onString,offString - HStackComponent (
src/components/hstack/hstack.component.ts) --alignmentderived fromjustifyContent,alignItems - CircularPercentageComponent (
src/components/circular-percentage/circular-percentage.component.ts) -- 4 sizing properties derived fromdimension - BatteryPercentageComponent (
src/components/battery-percentage/battery-percentage.component.ts) -- 7 rendering properties derived frompercentage,height,width - HalfGaugeComponent (
src/components/half-gauge/half-gauge.component.ts) --widthpx,heightpx,label,percentage,fontsizederived fromcurrent,min,max,unit,size - GraphComponent (
src/components/graph/graph.component.ts) --timeRangeMsderived fromtimeRangeSec - DoubleLineGraphComponent (
src/components/double-line-graph/double-line-graph.component.ts) --timeRangeMsderived fromtimeRangeSec - PieChartComponent (
src/components/pie-chart/pie-chart.component.ts) -- already usesinput()signals but reads them inngOnInitinstead ofcomputed()/effect() - SidebarCardComponent (
src/pages/graph-page/graph-sidebar/sidebar-card/sidebar-card.component.ts) --iconIdderived fromtitle - GraphSidebarMobileComponent (
src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.ts) --nodes,nodesWithVisibilityTogglederived fromdataTypes
Acceptance Criteria
- All 10 components migrated from
@Input()+ngOnInitderived state toinput()+computed() ngOnInitremoved from components where it only existed to compute derived input state- Templates updated to call signal getters (e.g.
innerCircleDimension()instead ofinnerCircleDimension) - No regressions in component rendering
npx ng lintandnpx prettier --checkpass
- 主要语言
- TypeScript
- 星标
- 5
- 派生
- 1
- 平均合并
- 5 天 13 小时
- 30 天内合并 PR
- 24
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Northeastern-Electric-Racing/Argos 的其他 Issue
-
Deliver telemetry selectively per screen over the existing Socket.IO transport可能已有人在做 @bracyw 于 17 天前认领。 未关闭angular-client difficult new feature scylla-server
Northeastern-Electric-Racing/Argos#777 · 已指派 1 人 ·
维护者通常 5 天内回复
-
Handle broker-initiated MQTT disconnects in the Flutter client可能已有人在做 @bracyw 于 22 天前认领。 未关闭bug dart medium
Northeastern-Electric-Racing/Argos#768 · 已指派 1 人 ·
维护者通常 5 天内回复
-
Prune CONTEXT.md glossary to genuinely ambiguous terms可能重新可做 @bracyw 于 75 天前认领,目前没有进行中的 PR。 未关闭ai-workflow needs-triage
Northeastern-Electric-Racing/Argos#716 · 已指派 1 人 ·
维护者通常 5 天内回复
-
Fix clipped content on BMS segment-detail cards at ~1028px width可能重新可做 @bracyw 于 75 天前认领,目前没有进行中的 PR。 未关闭angular-client bug needs-triage straightforward
Northeastern-Electric-Racing/Argos#715 · 已指派 1 人 ·
维护者通常 5 天内回复
-
Fix BMS At A Glance stat overlap and clipping at narrow widths可能重新可做 @bracyw 于 75 天前认领,目前没有进行中的 PR。 未关闭angular-client bug medium needs-triage
Northeastern-Electric-Racing/Argos#714 · 已指派 1 人 ·
维护者通常 5 天内回复
查看 Northeastern-Electric-Racing/Argos 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
openedx/frontend-app-authoring#3274 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
area/documentation status/need-triage
难度 1/5 1 小时以内 新手友好度 95/100
google-gemini/gemini-cli#29548 ·
维护者通常 1 天内回复
-
sdk-typescript vector-store
难度 2/5 半天 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复