Aedif / TokenVariants

GNU General Public License v3.0
17 stars 12 forks source link

If both expression fields have values it evaluates both #146

Open djc6460 opened 6 months ago

djc6460 commented 6 months ago

Describe the bug The expression field has an option to be either an expression or javascript code. If both of these have a value the mappings behave in unexpected ways.

To Reproduce Steps to reproduce the behavior:

  1. Go to the mappings for a token.
  2. Put in a valid expression
  3. Click the green button to switch to javascript
  4. Enter "aaaa" (obviously wrong)
  5. Switch back to expression by clicking the green button again so it shows the valid expression again.
  6. Despite the expression being valid and displayed, the mapping is always false.

Expected behavior I expected it to only evaluate to was currently being displayed. I assume it's evaluating both instead as an "and" or something weirder. It should either evaluate only the displayed one, or be more clear that it's still checking the hidden field. Took me a while to figure out what was happening.

Aedif commented 6 months ago

If both expressions are entered then both get evaluated with an AND.

So both expressions have to be valid for the mapping to be true.

This is intended behaviour but I guess I could make this a bit more clear. Will have a think about this.