Knockout-Contrib / Knockout-Contrib/Knockout-Validation

Async result still applied even when condition changed to false

Open
#549 11 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1k
Forks
366
PR merge metrics
No merged PRs in 30d

Description

The result of async rule is still being applied even when the condition has changed to false. This causes Knockout Validation to mark the observable as invalid even when it should be valid.

Timeline:
1. Observable is set to an invalid value.
2. Rule's condition is set to true.
3. Knockout Validation runs the async rule.
4. Rule's condition is changed to false
6. Async rule finishes and calls callback(false)
7. observables.isValid is false when it should be true!

Same problem occurs if the observable's value changes before the async rule finishes.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the timeline in the issue, including changing the rule condition and observable value while the async rule is pending. Trace the async rule callback and validity updates; done means a late callback no longer marks the observable invalid after either condition or value has changed.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.