Knockout-Contrib/Knockout-Validation

Too much recursion on deep grouping?

Open

#413 aperta il 18 mar 2014

Vedi su GitHub
 (8 commenti) (0 reazioni) (0 assegnatari)JavaScript (394 fork)batch import
help wanted

Metriche repository

Star
 (1024 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I have just updated to the new version so that I can validate elements within observable arrays.

Now I have added the grouping: { deep: true } to the configuration, and when I trigger validation the entire page locks up and then after about 5 seconds I get the error too much recursion.

Now I understand what the error means, its going too far down the tree when evaluating observables, and while my models are large they are not SUPER huge. So I am a bit baffled as to why it would cause this.

My object looks something like:

  • Character
    • Details (Pojo)
    • Notes (Pojo)
    • Credentials (Pojo)
    • Stats (Pojo)
    • Status (Pojo)
    • Skills (ObservableArray of Pojos, usually has about 10)
    • Powers (ObservableArray of Pojos, can have N amount, in this example has 1)
    • Items (ObservableArray of Pojos, can have N amount, in this example has 0)
    • Attacks (ObservableArray of Pojos, can have N amount, in this example has 1)

So I would not see this as a HUGE model, nor would I expect it takes that long to scan as it would only end up going down 2 levels as no Pojos contain any observable arrays. So is there anything else I should be doing or does it take significantly longer to do scans with observable arrays?

Guida contributor