Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1497] Alloy model - filtered change event fires with any attribute

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2017-03-09T21:35:55.000+0000
Affected Version/sRelease 5.2.2
Fix Version/sn/a
ComponentsModels
Labelsalloy, models
ReporterBrian García
AssigneeUnknown
Created2016-05-05T17:20:41.000+0000
Updated2018-03-07T22:28:26.000+0000

Description

Test case from alloy sample sql_no_migrations. Replace index.js with the attached file

steps to reproduce: - touch label at top bar to add an item as many times as you want - touch the added item - run the app again -touch any item -touch label at top bar - see the logs Expected: The expected log is to see only the secondTestField change. 'changed secondTestField expected secondTestField' Result: After running again the app and touching the top label the log is the following: 'changed firstTestFieldexpected secondTestField'

Attachments

FileDateSize
index.js2016-05-05T17:20:43.000+00001129
testCase.zip2016-05-05T19:33:12.000+000010478089

Comments

  1. Sharif AbuDarda 2016-05-05

    Hello, The code you provided for regenerating the issue is not sufficient enough. Replacing the index.js with the attached index.js shows the below error
       [ERROR] :  Error: Requested module not found: alloy/models/Thing
       [ERROR] :  File: app.js
       [ERROR] :  Line: undefined
       [ERROR] :  SourceId: undefined
       [ERROR] :  Backtrace:
       [ERROR] :  undefined
       
    Please provide a full reproducible test code. Regards, Sharif.
  2. Brian García 2016-05-05

    That's because I started from a sample project. I've attached the whole project. Thanks
  3. Sharif AbuDarda 2016-05-10

    Hello, I tried to test your issue. I was able to reproduce the issue. I found the following log on second run in ios. I follow instruction as run the app again -touch any item(I touched twice) -touch label at top bar see the logs
       [INFO] :   sha135/1.0 (5.2.2.b685ddb)
       [INFO] :   changed
       [INFO] :   {
       [INFO] :       changes =     {
       [INFO] :           secondTestField = 1;
       [INFO] :       };
       [INFO] :   }
       [INFO] :   changed secondTestFieldexpected secondTestField
       [INFO] :   changed
       [INFO] :   {
       [INFO] :       changes =     {
       [INFO] :           secondTestField = 1;
       [INFO] :       };
       [INFO] :   }
       [INFO] :   changed secondTestFieldexpected secondTestField
       [INFO] :   changed in save
       [INFO] :   {
       [INFO] :       changes =     {
       [INFO] :           firstTestField = 1;
       [INFO] :       };
       [INFO] :   }
       [INFO] :   changed firstTestFieldexpected secondTestField
       
    Regards, Sharif.
  4. Brian García 2016-05-10

    Thanks, as you can see the last log should be 'changed secondTestFieldexpected secondTestField' as the above ones but instead it is 'changed firstTestFieldexpected secondTestField' when the change event is binded only to secondTestField. Regards,
  5. Feon Sua Xin Miao 2017-03-09

    Please add to config.json "backbone": "1.1.2" and use [model.changedAttributes](http://backbonejs.org/#Model-changedAttributes) in the change event callback to retrieve a hash of only the model's attributes that have changed.
  6. Eric Merriman 2018-03-07

    Closing as invalid. If this is incorrect, please reopen.

JSON Source