Open peitschie opened 4 years ago
The reason why it happens is simple, the problem is I can't recall why that was added ;) I'll need to dig up a bit
PR is the works lets see this shouldn't hopefully take long to fix @peitschie. Love your nickname btw ;)
I'm submitting a bug report
Library Version: aurelia-i18n 3.0.0-beta.7
Webpack AND Version webpack 4.27.0 webpack-cli 3.3.5
Browser: all
Language: TypeScript 3.1.2
Current behavior: When using the
t.bind
syntax, translations will not be correctly cleared when bound value becomes undefined. Reproduction at: https://github.com/peitschie/bug-repro-aurelia-i18n-bind.On initial load, model A is populated, which contains a valid i18n key for both line 1 and 2:
Clicking the Load model B button then causes the bound values to be replaced with a new model that only has the line 1 property defined:
Note that when using the
t.bind
syntax, theModel A line 2 translation
cell is left bound.This behaviour differs when the key is fed via the
t
value converter (see the last column in the table), which does correctly clear the translation of line 2 when the second model is loaded.Expected/desired behavior: I am expecting the behaviour of
t.bind
to match the behaviour seen for${ key & t}
. It seems logical to me that if the bound value is set to undefined or cleared, the translation should also be cleared to reflect the new model.