Knockout-Contrib / Knockout-Contrib/Knockout-Validation
Too much recursion on deep grouping?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 366
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported recursion with grouping: { deep: true } and observable arrays; the issue names no repository files or tests. Trace the deep-grouping validation path and define done as identifying the recursion cause and confirming a fix with a regression case for the described object shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100