@attr boolean/number setter function called with an empty string (v2-beta)
- 主要言語
- TypeScript
- スター
- 1.4k
- フォーク
- 59
- 平均マージ
- 22時間 12分
- マージ済み PR(30日)
- 5
説明
This is maybe related to #117, but not 100% sure on that.
With a component defined like this:
```typescript
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):
```html
```
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:
```html
```
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 🫣
コントリビューションガイド
調査の方向性
Start at the @attr decorator entry point and reproduce the behavior with the TypeScript component and HTML snippets in the issue. Trace the setter calls for a missing boolean-prop attribute and compare them with the calls when an initial value is present. Done means the expected setter behavior is established and covered by an appropriate test or documented as a limitation.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100