Skip to content

Commit

Permalink
[blockly] Fix get persistence block disconnection
Browse files Browse the repository at this point in the history
Fix so oh_get_persistvalue block does not unnecessarily disconnect the ZDT input every time a different methodname is selected.

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
  • Loading branch information
jimtng committed Feb 7, 2024
1 parent 1d5d217 commit 4b0b18b
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,20 @@ export default function defineOHBlocks_Persistence (f7, isGraalJs, persistenceSe
if (this.getInput('skipPrevious')) {
this.removeInput('skipPrevious')
}
if (this.getInput('dayInfo')) {
this.removeInput('dayInfo')
}

const preposition = (this.methodName === 'historicState') ? 'at' : 'since'

this.appendValueInput('dayInfo')
.appendField(preposition)
.setAlign(Blockly.ALIGN_RIGHT)
.setCheck(['ZonedDateTime'])
if (!this.getInput('dayInfo')) {
this.appendValueInput('dayInfo')
.appendField(preposition, 'preposition')
.setCheck(['ZonedDateTime'])
this.moveInputBefore('dayInfo', 'persistenceName')
} else {
const prepositionField = this.getField('preposition')
if (prepositionField.getText() !== preposition) {
prepositionField.setValue(preposition)
}
}
}
}
}
Expand Down

0 comments on commit 4b0b18b

Please sign in to comment.