DynamicData icon indicating copy to clipboard operation
DynamicData copied to clipboard

Inner join, updates to left key

Open andersstorhaug opened this issue 3 years ago • 5 comments

From InnerJoin.cs, current head of main (follow link for more context): https://github.com/reactivemarbles/DynamicData/blob/b38c0d0840adff322791f165333bb356e949e8e6/src/DynamicData/Cache/Internal/InnerJoin.cs#L106

It appears that for an inner join, if a right value updates its left key, then InnerJoin will fail to remove it from the results if it no longer joins.

That's because on update of right values, results are removed only based on the current value of the left key, not the previous. To fix this, on update, It would seem that both current/previous left keys need to be taken into account.

I haven't had the time to look into this further / confirm, but I wanted to raise an issue here before I lose sight of it.

andersstorhaug avatar Apr 06 '22 22:04 andersstorhaug

Thanks for pointing this out. I will take a look soon (on vacation right now).

RolandPheasant avatar Apr 07 '22 06:04 RolandPheasant

If you have time and want to help @RolandPheasant out, if you get time might be worth just providing a unit test to help out.

glennawatson avatar Apr 07 '22 06:04 glennawatson

Will do, I believe that both the reproduction and the fix are fairly simple, so I may be able to get a PR out here within a couple of days.

andersstorhaug avatar Apr 07 '22 14:04 andersstorhaug

@andersstorhaug Is this still and issue?

RolandPheasant avatar Nov 02 '23 21:11 RolandPheasant

I came here to add a feature request for this topic, and found this thread.

As of version 8.3.27 I think this is still happening. I encountered my own issue where an inner join had strange side effects when a key on the right side is modified at runtime.

https://github.com/jbooth88/DynamicData-Filtering-Join

Above is a link to a sample project I posted in Slack for review, it illustrates the issue. Unfortunately I am not comfortable in making unit tests, so I cannot help you there. :(

jbooth88 avatar Jan 26 '24 17:01 jbooth88