[MGNLUI-3955] Switching authoring locale changes values of non-i18ned fields Created: 20/Jul/16 Updated: 11/Aug/17 Resolved: 07/Mar/17 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | dialogs, forms |
| Affects Version/s: | 5.4.4, 5.4.5, 5.4.6, 5.4.7 |
| Fix Version/s: | 5.4.12, 5.5.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vivian Steller | Assignee: | Ngoc Nguyenthanh |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | regression | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 9d 1.5h | ||
| Original Estimate: | 1.5d | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Sprint: | Saigon 77, Saigon 78, Saigon 79, Saigon 80, Saigon 81, Saigon 82, Saigon 83, Saigon 84, Saigon 85, Saigon 86 | ||||||||||||||||
| Story Points: | 8 | ||||||||||||||||
| Description |
|
In a form dialog, switching locales also changes the values of non-i18ned fields, which is wrong. To reproduce the issue on demo author: Note that the last entered value is being stored when saving the form, which is correct. It seems that the field's values are not properly synchronized for non-i18ned fields. I wasn't able to figure out in detail where the code breaks: I might be wrong but I think the underlying datasource property still contains the correct value after the info.magnolia.ui.vaadin.form.FormViewReduced.Listener#localeChanged event is fired. There must be some event occurring thereafter which changes the value incorrectly. |
| Comments |
| Comment by Ngoc Nguyenthanh [ 05/Jan/17 ] |
|
Re:
FormPresenterImpl#setLocale will be fired when switching language. When the field is change, changedProperties in itemDataSource will be updated. But seem like we don't have a mechanism to reflect the changed property (model) to the UI. |
| Comment by Ngoc Nguyenthanh [ 06/Jan/17 ] |
|
A UI-Test to cover this case in SimpleFieldUITest
@Test
public void setNonI18nTextFieldValue() {
// GIVEN
goToDialogShowRoomAndOpenDialogComponent("ftl");
openTabWithCaption("Edit controls");
// WHEN
// Set input values
switchToLanguage("German");
setFormTextFieldText("Text 1", "test-de");
switchToLanguage("English");
setFormTextFieldText("Text 1", "test-en");
switchToLanguage("German");
// THEN
assertEquals("test-en", getFormTextField("Text 1").getAttribute("value"));
}
|
| Comment by Mikaël Geljić [ 09/Jan/17 ] |
|
Thanks ngoc.nguyenthanh A. Remove the null check in FormPresenterImpl#setLocale:155
B. Reuse non-i18n fields throughout locales
apchelintcev Any objection against option A, or any caveat you remember from the previous iteration? —I pasted some bits from the commit message below, in case that rings a bell. * Extract and publish FormBuilder method for tab and field creation
* Introduce FormPresenter component
* encapsulates operations w/ FormBuilder
* supports re-creation of the tab contents upon locale change
* Form UI components bug-fixing and improvements according to FormPresenter
* introduction - prevent MagnoliaFormTab from unnecessary #content field mangling
|
| Comment by Vivian Steller [ 07/Mar/17 ] |
|
Congratulations, folks! Thanks for fixing this |