Closed sszabolcs closed 7 years ago
I this a problem with baseMap?
@sszabolcs I can't replicate this issue. The second JSfiddle provided seems to work correctly. I am closing this issue, for now. Feel free to re-open it if you are still having problems.
In reviewing the two jsfiddles, the expected behavior seems to result in each. I also couldn't seem to reproduce this locally. Perhaps I am misunderstanding the issue? cc: @sszabolcs
EDIT: Sorry, I was looking into this yesterday as well as @imaustink but Github didn't push his comment to my browser.
How often can you reproduce it?
Description: If I give a custom id property to my can.Model and issue a findOne() command for the second time - to reload the model - can-connect/can/model/model.js does not find the id value in the response data and so it does not refresh the model in the store. model.js@1.3.8 in line 41:
var idProp = inst.constructor.id || 'id';
results 'id' as idProp value but should result the custom id property name. If I rewrite this line to this:var idProp = inst.constructor.id || this.idProp || 'id';
i.e. add 'this.idProp' to the line then idProp gets the correct value, my custom id property name and the model in the store refreshes.Steps to reproduce:
Here is a fiddle which works, it uses 'stock' id property, the model is refreshed after the save, when the second findOne call finishes: https://jsfiddle.net/9uq9s7kp/
Here is a fiddle with custom id prop value which does not refresh the model after the save, when the second findOne call finishes: https://jsfiddle.net/fxez1erz/
Expected results: After clicking the Save link the changeCount in the model should increase because it is increased on the 'server' side.
Environment: