KEMBAR78
Avoid redundant initialisation of TypedInput type by knolleary · Pull Request #3263 · node-red/node-red · GitHub
Skip to content

Conversation

knolleary
Copy link
Member

  • Bugfix (non-breaking change which fixes an issue)

Reported on the forum, if a TypedInput is initialised with a list of types where the first type in the list has no value (eg, timestamp), but the node property is a different type with value (eg str), then the TI gets the right type, but the value is blank.

This is happening because when the TI is initialised, it first sets the types, which causes the type to be primed as the first in the list (timestamp). It then applies the actual type (str), which is seen as a change in type from no-value to value - and it restores the 'old' value which is blank - overwriting the right value that was already there.

The fix is to not set the type when setting the types list if its part of the initialisation of the whole widget - because we know we'll be setting it to the right type a few lines later.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 67.37% when pulling fba6e80 on ti-fix into 3e0f080 on master.

@knolleary knolleary merged commit a091b82 into master Nov 22, 2021
@knolleary knolleary deleted the ti-fix branch November 22, 2021 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants