Closed valeriy-maslov closed 8 years ago
Platypus.js cancels prior calls to model.requery()
. So only one callback (the last one) will be called.
Take a look on model.entity.query(parameters, function(aData){...}
. It allows simultaneous calls and provides its callback with different results, according to parameters argument.
Recently I've noticed that in html5 client
model.requery()
acting strange working with global API (could be with AMD too). It took some time to find a reason and a way to reproduce this kinda behaviour. So I try to explain the way I get it. Please, check this out.E.g. we have html5 client module
StuckModule
working in browser. There is a model with single query in it:model.example
. And it has element classECItem
.Also
ECItem
has it's own model inside and some methods using it.So let's assume that there is some process in
StuckModule
which making something with data and calls methodsomething()
of the single instance ofECItem
several times, e.g. to set calculated values to GUI widgets, it's not important right now.Please note that all this calls made from one method in
StuckModule
. So the thing is that second call ofsomething()
made untilrequery()
inside the first call did not finished yet, sov1
still has not any data and second call also goes intorequery()
branch. But as I can undestand Platypus prevents doublerequery()
calling in same context, so success callback of requery works only on first call and never in second, third etc.The question: Is there any way to make it possible to call
requery()
of the same model several times (including calls with different params) so all appropriate callbacks worked nicely? Is that a bug or something anyway?