Skip to content

Commit ada7f58

Browse files
AnwarElboGuillaume Chau
authored andcommitted
fix: Show 0 as a valid key in the component tree, closes #827 (#828)
* #827: Show 0 as a valid key in the component tree * Delete spaces * test(e2e): 0 key Co-authored-by: Guillaume Chau <[email protected]>
1 parent 8588154 commit ada7f58

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

cypress/integration/components-tab.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ suite('components tab', () => {
2828
})
2929
})
3030

31+
it('should display 0 key', () => {
32+
cy.get('.tree > .instance .instance:nth-child(2)').within(() => {
33+
cy.get('.arrow').click().then(() => {
34+
cy.get('.instance:nth-child(3) .attr').contains('key=0')
35+
})
36+
})
37+
})
38+
3139
it('should detect components in transition', () => {
3240
cy.get('.tree > .instance .instance:nth-child(7)').within(() => {
3341
cy.get('.arrow').click().then(() => {

shells/dev/target/Target.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<Functional
2828
name="Embed component"
2929
>
30-
<Other />
30+
<Other :key="0" />
3131
</Functional>
3232
<Functional
3333
name="Embed functional component"

src/devtools/views/components/ComponentInstance.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export default {
146146
},
147147
148148
componentHasKey () {
149-
return !!this.instance.renderKey && this.instance.renderKey !== UNDEFINED
149+
return (this.instance.renderKey === 0 || !!this.instance.renderKey) && this.instance.renderKey !== UNDEFINED
150150
}
151151
},
152152

0 commit comments

Comments
 (0)