Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): enable drafting prop on empty object #223

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading