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

Fix ko.observable handling in Linq translations #1870

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

exyi
Copy link
Member

@exyi exyi commented Oct 16, 2024

  • FirstOrDefault, LastOrDefault, ... should behave like indexers
    • return observable, if the array contains observables, which then needs to be unwrapped
    • this is a regression in 4.3
  • Where, Order, Take, ... return the same structure which the original array has
  • Select is weird as it unwraps all observables in the array, but not recursively. That's why patch adds the JsObjectObservableMap object, which can represent this mid-state (and many other combinations)
    • Indexing after Select was apparently always broken in DotVVM

exyi added a commit that referenced this pull request Oct 16, 2024
This is a lighterweight alternative to #1870,
which we might not want to merge to 4.3.
This PR does only fixes the 4.3 regression,
the problem with .Select(...).ToArray()[0] is not fixed
@exyi exyi force-pushed the fix-linq-translations-observables branch 5 times, most recently from 43e5a18 to 562c26f Compare October 16, 2024 20:54
@tomasherceg tomasherceg added this to the Version 5.0 milestone Oct 18, 2024
* FirstOrDefault, LastOrDefault, ... should behave like indexers
    - return observable, if the array contains observables, which then needs to be unwrapped
    - this is a regression in 4.3
* Where, Order, Take, ... return the same structure which the original array has
* Select is weird as it unwraps all observables in the array, but not recursively. That's why patch adds the JsObjectObservableMap object, which can represent this mid-state (and many other combinations)
   - Indexing after Select was apparently always broken in DotVVM
@exyi exyi force-pushed the fix-linq-translations-observables branch from 562c26f to 2f374f5 Compare October 20, 2024 14:13
exyi added a commit that referenced this pull request Oct 27, 2024
This is a lighterweight alternative to #1870,
which we might not want to merge to 4.3.
This PR does only fixes the 4.3 regression,
the problem with .Select(...).ToArray()[0] is not fixed
@exyi exyi force-pushed the fix-linq-translations-observables branch from 2f374f5 to 79963b5 Compare November 3, 2024 10:40
@tomasherceg tomasherceg merged commit 06964d7 into main Nov 3, 2024
13 of 16 checks passed
@tomasherceg tomasherceg deleted the fix-linq-translations-observables branch November 3, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants