Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computed Properties: Dependency resolution bug #11

Open
monokee opened this issue Jan 16, 2020 · 3 comments
Open

Computed Properties: Dependency resolution bug #11

monokee opened this issue Jan 16, 2020 · 3 comments
Labels
bug Something isn't working fixed The reported bug has been fixed

Comments

@monokee
Copy link
Owner

monokee commented Jan 16, 2020

Stumbled upon the following case:

Update county -> Changes Tax -> recalculate total
Update quantity -> changes priceBeforeDiscount & tax

  • priceBeforeDiscount -> changes subTotal -> changes total
  • Tax -> changes total

In this case Total is computed from subtotal (computed from priceBeforeDiscount + tax)
and Tax (not computed).
So subtotal needs to be resolved before total. Current implementation is buggy b/c total is recalculated first.

@monokee monokee added the bug Something isn't working label Jan 16, 2020
@monokee
Copy link
Owner Author

monokee commented Jan 18, 2020

possibly related to synchronous handling -> #12

@monokee
Copy link
Owner Author

monokee commented Jan 18, 2020

still buggy after async implementation in v1.04-beta

@monokee
Copy link
Owner Author

monokee commented Jan 21, 2020

Store events can be executed in a nested queue to ensure compatibility between Component bindings and external handlers bound via Store.subscribe. This mechanism can lead to the evaluation of stale computations from the prior reaction loop.

To fix, simply add Store Events to their own dedicated Reactor Queue and unpack it prior to resolving computations and executing callbacks. This way, if a Store Event adds its own computations or callbacks because it has been bound via Components, they will be correctly evaluated in a single reaction loop.

Fixed in v.1.05-beta

@monokee monokee closed this as completed Jan 21, 2020
monokee added a commit that referenced this issue Jan 21, 2020
@monokee monokee reopened this Mar 7, 2022
@monokee monokee added the fixed The reported bug has been fixed label Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed The reported bug has been fixed
Projects
None yet
Development

No branches or pull requests

1 participant