@attr boolean/number setter function called with an empty string (v2-beta)
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- frontend
调研方向
从 @attr 装饰器入口点开始,使用 issue 中的 TypeScript 组件和 HTML 代码片段复现该行为。跟踪缺失 boolean-prop 属性时的 setter 调用,并将其与存在初始值时的调用进行比较。当预期的 setter 行为得到确立,并由适当的测试覆盖或记录为限制时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
This is maybe related to #117, but not 100% sure on that.
With a component defined like this:
import { controller, attr } from '@github/catalyst'
@controller
class TestComponentElement extends HTMLElement {
@attr get booleanProp() {
return false
}
set booleanProp( _v: boolean ) {
console.dir( `booleanProp type: ${ typeof _v }` )
console.dir( `booleanProp value: '${ _v }'` )
}
connectedCallback() {
this.booleanProp = true
}
}
and html like this (note the lack of an initial boolean-prop value):
<test-component></test-component>
I get these log messages:
booleanProp type: boolean
booleanProp value: 'true'
booleanProp type: string
booleanProp value: ''
Changing the html to include an initial value like this:
<test-component boolean-prop='anything'></test-component>
get's rid of that final empty string call:
booleanProp type: boolean
booleanProp value: 'true'
Maybe this is a limitation? Hopefully this isn't another ghost bug, sorry about the last one 🫣
- 主要语言
- TypeScript
- 星标
- 1.4k
- 派生
- 61
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 8
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/catalyst 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 3/5 1-2 天 新手友好度 62/100
-
难度 5/5 一周以上 新手友好度 20/100
-
难度 5/5 一周以上 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 42/100
相似的 Issue
-
normalizePropName strips `#` characters from Figma property names instead of only the `#id` suffix未关闭
难度 2/5 1-3 小时 新手友好度 72/100
figma/code-connect#419 ·
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
Koenkk/zigbee-herdsman-converters#13820 ·
维护者通常 2 天内回复
-
A live recovery copy treats a large whole number and text with the same digits as the same value未关闭bug sharing & sync
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
[prefer-expect-resolves] autofix leaves a stray ")" when the awaited expression is parenthesized未关闭
难度 2/5 1-3 小时 新手友好度 78/100
jest-community/eslint-plugin-jest#2052 ·