Skip to content

Commit

Permalink
fix: Add rootId into expand key
Browse files Browse the repository at this point in the history
  • Loading branch information
Azurewarth0920 committed Jan 2, 2024
1 parent a34c3d9 commit 8281d51
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ createStateEditorContext({
{{ name }}
</span>
</div>
<InspectorStateType v-if="isExpanded" :data="data" />
<InspectorStateType v-if="isExpanded" :data="data" :root-id="id" />
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const props = withDefaults(defineProps<{
data: InspectorState
depth?: number
no: number
rootId: string
}>(), {
depth: 0,
})
Expand All @@ -26,7 +27,7 @@ const stateFormatClass = computed(() => {
return ``
})
const { isExpanded, toggleCollapse } = useCollapse('inspector-state', `${props.no}-${props.depth}-${props.data.key}`)
const { isExpanded, toggleCollapse } = useCollapse('inspector-state', `${props.rootId}-${props.no}-${props.depth}-${props.data.key}`)
const normalizedValue = computed(() => {
const stateTypeName = (props.data as InspectorCustomState)._custom?.stateTypeName || props.data?.stateTypeName
Expand Down Expand Up @@ -208,7 +209,7 @@ const { isHovering } = useHover(containerRef)
</div>
<div v-if="isExpanded">
<InspectorStateField
v-for="(field, index) in normalizedChildField" :key="index" :data="field" :depth="depth + 1" :no="no"
v-for="(field, index) in normalizedChildField" :key="index" :data="field" :depth="depth + 1" :no="no" :root-id="rootId"
/>
<div v-if="draftingNewProp.enable" :style="{ paddingLeft: `${(depth + 1) * 15 + 4}px` }">
<span overflow-hidden text-ellipsis whitespace-nowrap state-key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { InspectorState } from '@vue/devtools-kit'
withDefaults(defineProps<{
data: InspectorState[]
depth?: number
rootId: string
}>(), {
depth: 0,
})
Expand All @@ -14,6 +15,6 @@ withDefaults(defineProps<{
v-for="(item, index) in data"
:key="index" class="flex items-center pl-8 font-data-field"
>
<InspectorStateField :data="item" :no="index" />
<InspectorStateField :data="item" :no="index" :root-id="rootId" />
</div>
</template>

0 comments on commit 8281d51

Please sign in to comment.