Entire code sample below.
The problem I have is that I know vatSuccess is actually changing successfully. However when I try to do anything with it in a reactive manner when I know it should be true it does not seem to work.
In the sample below I would expect the reactive statement console logging 'vatSuccess' to run twice first when it's declared as false and then again when it becomes true.
However it only runs the first time
let vatSuccess = falselet nameSuccess = falsefunction handleVatValidation(): Error { // Vat is optional so putting nothing passes validation if (companyInformation.vat.length === 0) { vatSuccess = true vatError = null return null } if (companyInformation.vat.length < 6) { vatSuccess = false vatError = 'vat must be at least 6 characters' return 'vat must be at least 6 characters' } vatSuccess = true console.log('vatSuccess', vatSuccess) // This code runs and prints true vatError = null return null}$: { console.log('vatSuccess', vatSuccess) // This only runs once when it is false}
I have tried to change it liek this so vatSuccess is a reactive value to begin with but the behaviour is the same.
$: vatSuccess = false