1.6 ajax create success and then auto ajax update
kkxlkkxllb opened this issue · comments
2c6fc40
This commit caused problem when i do SomeModel.create data
use ajax, then it send a PUT request after sent a POST request, because the id in POST request's response doesn't equal to the auto created cid. i think ChangeID method should be put in Ajax.disable
Thanks for the bug report, I've added a failing unit test.
@aeischeid @richard-flosi any thoughts on this?
I had only glanced at this yesterday. The failing test gives me a much better idea what is going on, so thanks for that. As for how to fix... I will have to dig into it and check back.
I never noticed an extra PUT after a create. What version did this start happening in?
probably introduced in 1.6
yes, just happen in 1.6 version
we have a almost circular call going on.
because Model.create calls save and save calls create or update... I threw in some log statements and it looked like this:
first model create... spine.js:473:7
next model instance save...? spine.js:650:7
then ajax extension create...? ajax.js:279:7
next model instance save...? spine.js:650:7
finally ajax extension update...
seems like might be a tricky fix. I am going to play around a bit and see what I can figure out
removing the @save()
from the changeId method makes all tests pass. I am still trying to reason out if that is really a good thing to do though.
I think this can be closed. @kkxlkkxllb can you test with latest spine (1.6.1) and report back.
@aeischeid Thx, i have tested it with 1.6.1, it looks good.