Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</template>

<script>
import { watch, ref, toRefs, computed } from '@vue/composition-api'
import { watch, ref, toRefs, computed, onMounted } from '@vue/composition-api'
import addIndex from './add-index'
import findInTree from './find-in-tree'
import addParentIdToLayers from './add-parent-id-to-layers'
Expand All @@ -58,6 +58,10 @@ export default {
const { activeLegend, setActiveLegend } = useLegend(selectedIds)
const { onSortingChange } = useSortable(layers, root, openItems)

onMounted(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're delegating responsibility for clearing state (the ref in useSelected) to the Vue component. Is this really desired, or should useSelected() return a 'scoped' piece of state, so that every LayerListControls component has its own selectedIds that is strictly private to that instance of the component?

setSelectedIds([])
})

const sortedSelectedLayers = computed(() => {
const withIndex = addIndex(layers.value)
return selectedIds.value
Expand Down