diff --git a/models/Component.cfc b/models/Component.cfc index b5d6567a..3f8288e0 100644 --- a/models/Component.cfc +++ b/models/Component.cfc @@ -737,6 +737,7 @@ component output="true" { * @return void */ function _applyUpdates( updates ) { + if ( !updates.count() ) return; // Capture old values local.oldValues = duplicate( data ); // Array to track which array props were updated diff --git a/test-harness/tests/specs/CBWIRESpec.cfc b/test-harness/tests/specs/CBWIRESpec.cfc index 7ea334cb..4866af43 100644 --- a/test-harness/tests/specs/CBWIRESpec.cfc +++ b/test-harness/tests/specs/CBWIRESpec.cfc @@ -720,6 +720,23 @@ component extends="coldbox.system.testing.BaseTestCase" { expect( response.components[1].effects.html ).toInclude( "onUpdateCalled: true" ); } ); + it( "should not call onupdate if no updates are actually passed", function() { + var payload = incomingRequest( + memo = { + "name": "test.should_call_onupdate", + "id": "Z1Ruz1tGMPXSfw7osBW2", + "children": [] + }, + data = { + "cbwireVersion": 3 + }, + calls = [], + updates = {} + ); + var response = cbwireController.handleRequest( payload, event ); + expect( response.components[1].effects.html ).toInclude( "onUpdateCalled: false" ); + } ); + it( "should call onUpdate[Property] if it exists", function() { var payload = incomingRequest( memo = {