forked from dart-archive/angular.dart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): OneWayOneTime bindings now wait for the model to stablize
BREAKING CHANGE Previously, OneWayOneTime bindings would remove their watch after the first value assignment. For models that take more than one digest loop to stablize, this meant the OneWayOneTime bindings took a un-stablized value. With this change, these bindings will continue to accept value assignments until their stablized value is non-null. The assignment may occur multiple times. We expect that most uses of OneWayOneTime will be 'ok' with being called a few times as the model stablizes. However, applications which depend on OneWayOneTime bindings being called exactly once will break. The suggested upgrade path is to move the senstive code into a domWrite callback. e.g. the old code: @decorator( map: const { 'one-time': '=>!value' }) class OneTime { set value(v) => onlyCalledOnce(v); } becomes @decorator( map: const { 'one-time': '=>!value' }) class OneTime { var _value; set value(v) { if (_value == null) { scope.rootScope.domWrite(() => onlyCalledOnce(_value)); } _value = v; } } Closes dart-archive#1013
- Loading branch information
Showing
2 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters