Skip to content

Commit

Permalink
fix(client): enable drafting prop on empty object (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
Azurewarth0920 authored Feb 4, 2024
1 parent 9695db5 commit d30424a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/client/src/components/inspector/InspectorStateField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ const normalizedDisplayedKey = computed(() => {
return key.slice(lastDotIndex + 1)
})
const hasChildren = computed(() => {
return Object.keys(normalizedChildField.value).length > 0
})
// ---------------------------- edit ----------------------------
const { editingType, editing, editingText, toggleEditing, nodeId } = useStateEditor()
Expand Down Expand Up @@ -163,6 +159,12 @@ function submitDrafting() {
resetDrafting()
}
const hasChildren = computed(() => {
return Object.keys(normalizedChildField.value).length > 0
// Regard empty object has children When drafting a new property.
|| draftingNewProp.value.enable
})
const containerRef = ref<HTMLDivElement>()
const { isHovering } = useHover(() => containerRef.value)
</script>
Expand All @@ -181,6 +183,7 @@ const { isHovering } = useHover(() => containerRef.value)
<Actions
:hovering="isHovering" :disable-edit="state.disableEdit"
:data="data" :depth="depth" @enable-edit-input="toggleEditing"
@add-new-prop="addNewProp"
/>
</template>
</div>
Expand Down

0 comments on commit d30424a

Please sign in to comment.