Added null propagation operators

This commit is contained in:
Mel O'Hagan 2022-10-13 16:17:47 +01:00
parent fe4b5502d4
commit f9ed72f670
1 changed files with 6 additions and 4 deletions

View File

@ -38,17 +38,19 @@
function updateEditorsOnDelete(deleteIndex) { function updateEditorsOnDelete(deleteIndex) {
for (let i = deleteIndex; i < query.fields.steps?.length - 1; i++) { for (let i = deleteIndex; i < query.fields.steps?.length - 1; i++) {
stepEditors[i].update(query.fields.steps[i + 1].value.value) stepEditors[i].update(query.fields.steps[i + 1].value?.value)
} }
} }
function updateEditorsOnSwap(actionIndex, targetIndex) { function updateEditorsOnSwap(actionIndex, targetIndex) {
const target = query.fields.steps[targetIndex].value.value const target = query.fields.steps[targetIndex].value?.value
stepEditors[targetIndex].update(query.fields.steps[actionIndex].value.value) stepEditors[targetIndex].update(
query.fields.steps[actionIndex].value?.value
)
stepEditors[actionIndex].update(target) stepEditors[actionIndex].update(target)
} }
function setEditorTemplate(fromKey, toKey, index) { function setEditorTemplate(fromKey, toKey, index) {
const currentValue = query.fields.steps[index].value.value const currentValue = query.fields.steps[index].value?.value
if ( if (
!currentValue || !currentValue ||
currentValue.toString().replace("\\s", "").length < 3 || currentValue.toString().replace("\\s", "").length < 3 ||