Knockout-Contrib/Knockout-Validation

Too much recursion on deep grouping?

Open

#413 opened on Mar 18, 2014

View on GitHub
 (8 comments) (0 reactions) (0 assignees)JavaScript (394 forks)batch import
help wanted

Repository metrics

Stars
 (1,024 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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?

Contributor guide