Skip to content

Commit

Permalink
fix: don't catch error when field can't be found
Browse files Browse the repository at this point in the history
Errors are thrown for a reason, so we should be displaying them
  • Loading branch information
dulnan committed Nov 12, 2024
1 parent b79c2b9 commit 640eb65
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/runtime/components/Edit/Features/Duplicate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ function onClick(items: DraggableExistingBlock[]) {
)
}
const findField = (uuid: string): BlokkliFieldElement | undefined => {
try {
return dom.getBlockField(uuid)
} catch (_e) {
// Noop.
}
}
const canDuplicate = computed<boolean>(() => {
if (state.editMode.value !== 'editing') {
return false
Expand All @@ -57,11 +49,7 @@ const canDuplicate = computed<boolean>(() => {
const selectedCount = selection.blocks.value.length
for (let i = 0; i < selectedCount; i++) {
const block = selection.blocks.value[i]
const field = findField(block.uuid)
if (!field) {
return false
}
const field = dom.getBlockField(block.uuid)
const count = state.getFieldBlockCount(field.key)
// Early return if the field is already full.
Expand Down

0 comments on commit 640eb65

Please sign in to comment.