Parsley.js icon indicating copy to clipboard operation
Parsley.js copied to clipboard

Policy: Does Parsley reject outdated remote responses?

Open xDaizu opened this issue 8 years ago • 3 comments

This is not a bug report, but a request for some info that I think should be included in the documentation according the remote validation, which I need to know in order to decide if your library meets my need. Let's imagine that "Plane" is the valid text for the field. In this use case:

I type Planes

Checks for P -> response: false Checks for Pl -> response: false Checks for Pla-> response:false Checks for Plan -> response: false Checks for Plane -> no response Checks for Planes -> response:false --the response for "Plane" arrives (true)

It's the field considered valid or not? Does it detect that the request for "Plane" is no longer required and, thus, its content is outdated/invalid? This is a HUGE selling/runaway point, so I think the behaviour should be stated in the documentation.

Thanks for your attention

xDaizu avatar Jun 27 '16 11:06 xDaizu

I'd say that's a bug. We should ignore responses that come out of order.

Note: I'll be in vacation till end of July, so I might not have time to address this for a while. As always, PR welcome :smile:

marcandre avatar Jun 27 '16 15:06 marcandre

@marcandre Excuse me, I think I didn't express myself properly. Sorry about that. I'm not reporting that behaviour. I'm asking what is the current behaviour policy for the library in that case. I don't have the means to implement and try it myself right now.

At least now I know that ignoring old responses is the desired behaviour. Is it implemented, though?

xDaizu avatar Jun 27 '16 15:06 xDaizu

No attempt to handle out of order responses is made currently, so the wrong value will show as ok in your example.

It's not too difficult to test with a custom validator that returns promises, btw. Call validate twice, reject the second promise before you fullfill the first one.

Besides the error and success events, we'll probably have to add a third possibility, say ignored or something.

marcandre avatar Jun 27 '16 15:06 marcandre