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

[Reactive] Entity tracking on modification #688

Closed
5 tasks done
dr1rrb opened this issue Aug 31, 2022 · 0 comments · Fixed by #776
Closed
5 tasks done

[Reactive] Entity tracking on modification #688

dr1rrb opened this issue Aug 31, 2022 · 0 comments · Fixed by #776
Assignees
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.

Comments

@dr1rrb
Copy link
Member

dr1rrb commented Aug 31, 2022

Current behavior

We didn't provided public API to properly track multiple versions of a same entity (a.k.a. IKeyEquatable), so when we edit an entity (i.e. we replace it as entities are expected to be immutable), the entity tracking raises a remove and a add.

This can causes issues with animations in ListView.

Expected behavior

We should be able to get a replace for shuch updates.

How to reproduce it (as minimally and precisely as possible)

public record MyObject(int Id, int Version);

public ListState<MyObject> Items => ListState<MyObject>.Value(this, () => Enumerable.Range(0, 10).Select(i => new MyObject(i, 0)).ToImmutableList());

public async ValueTask Update()
    => await Items.Update(list => list.SetItem(2, new MyObject(2, list[2].Version + 1)));

Data-bind to a ListView and observe that invoking the Update will cause some animations.

Environment

Nuget Package: Uno.Extensions.Reactive.[Win]UI
Package Version(s): latest
Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows

Workaround

To hide the issue you can just disable entrance and exit animations on the ListView.

On Android and iOS you also have to disable the native animations:

  • For Android, this is done globally in the app by setting feature flag: FeatureConfiguration.NativeListViewBase.RemoveItemAnimator = true; (note: this is the default value).
  • On iOS: you have to the uno only flag on directly on your ListView: ios:UseCollectionAnimations="False" (You can set it globally in the app by creating an implciti style for your the ListView).
@dr1rrb dr1rrb added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification. labels Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant