@@ -243,28 +243,35 @@ class Provider extends Base {
243243 */
244244 createBinding ( componentId , configKey , formatter ) {
245245 const
246- me = this ,
247- effect = new Effect ( ( ) => {
248- const component = Neo . get ( componentId ) ;
246+ me = this ,
247+ mapKey = ` ${ componentId } - ${ configKey } ` ,
248+ oldEffect = me . #bindingEffects . get ( mapKey ) ;
249249
250- if ( component && ! component . isDestroyed ) {
251- const
252- hierarchicalData = me . getHierarchyData ( ) ,
253- newValue = Neo . isFunction ( formatter ) ? formatter . call ( me , hierarchicalData ) : hierarchicalData [ formatter ] ;
250+ if ( oldEffect ) {
251+ oldEffect . destroy ( )
252+ }
254253
255- component . _skipTwoWayPush = configKey ;
256- component [ configKey ] = newValue ;
257- delete component . _skipTwoWayPush
258- }
259- } ) ;
254+ const effect = new Effect ( ( ) => {
255+ const component = Neo . get ( componentId ) ;
256+
257+ if ( component && ! component . isDestroyed ) {
258+ const
259+ hierarchicalData = me . getHierarchyData ( ) ,
260+ newValue = Neo . isFunction ( formatter ) ? formatter . call ( me , hierarchicalData ) : hierarchicalData [ formatter ] ;
261+
262+ component . _skipTwoWayPush = configKey ;
263+ component [ configKey ] = newValue ;
264+ delete component . _skipTwoWayPush
265+ }
266+ } ) ;
260267
261- me . #bindingEffects. set ( componentId , effect ) ;
268+ me . #bindingEffects. set ( mapKey , effect ) ;
262269
263270 // The effect observes the component's destruction to clean itself up.
264271 me . observeConfig ( componentId , 'isDestroying' , ( value ) => {
265272 if ( value ) {
266273 effect . destroy ( ) ;
267- me . #bindingEffects. delete ( componentId )
274+ me . #bindingEffects. delete ( mapKey )
268275 }
269276 } ) ;
270277
0 commit comments