-
8 Dec 2011 11:39 AM #1
[FNR] (Beta) TriggerFieldCell racing conditions
[FNR] (Beta) TriggerFieldCell racing conditions
Looks like there are racing conditions in TriggerFieldCell class. Sometimes selected value (e.g. in ComboBox) is not updated in CellComponent, though cell itself contains it. There are three methods in TriggerFieldCell that, I suppose, called in wrong order for some reason.
Here is the custom ComboBoxCell just to log the methods calls order:
Here what I get in the log:Code:ComboBoxCell<Type> customCell = new ComboBoxCell<Type>(typeStore, typeProperties.title(), typeProperties.title()) { @Override protected void clearContext() { Log.info("clearContext"); super.clearContext(); } @Override protected void saveContext(Context context, Element parent, NativeEvent event, ValueUpdater<Type> typeValueUpdater, Type value) { Log.info("saveContext"); super.saveContext(context, parent, event, typeValueUpdater, value); } @Override protected void finishEditing(Element parent, Type value, Object key, ValueUpdater<Type> typeValueUpdater) { Log.info("finishEditing"); super.finishEditing(parent, value, key, typeValueUpdater); } };
The problem is that clearContext sets valueUpdater to null:(AttributeViewImpl.java:87) 2011-12-08 22:03:34,950 [INFO ] clearContext
(AttributeViewImpl.java:99) 2011-12-08 22:03:42,419 [INFO ] finishEditing
(AttributeViewImpl.java:93) 2011-12-08 22:03:42,481 [INFO ] saveContext
But the TriggerFieldCell.finishEditing(...) requires lastValueUpdater to be not null in order to update value in it:Code:protected void clearContext() { lastContext = null; lastParent = null; lastValueUpdater = null; lastValue = null; }
If I set a break point in clearContext() which is called from collapse(), resume execution, then saveContext() is called prior finishEditing method call (I think it because browser events occurre).Code:// Fire the value updater if the value has changed. if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) { ... // updating value in component
-
15 Dec 2011 2:30 PM #2
Thanks for digging into the code and providing a detailed report. This is now fixed in SVN. We made several changes around the order in which code is executed during an edit. You can see the latest code here:
http://staging.sencha.com:8080/examp...e:formsexample
http://staging.sencha.com:8080/examp...needitablegrid
Let me know if you see anything not working correctly. Changes will go out next week in our beta 2 release.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote