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

Nested measure on ListView may cause duplicate items #4925

Closed
3 of 24 tasks
MartinZikmund opened this issue Jan 17, 2021 · 1 comment · Fixed by #14701
Closed
3 of 24 tasks

Nested measure on ListView may cause duplicate items #4925

MartinZikmund opened this issue Jan 17, 2021 · 1 comment · Fixed by #14701
Assignees
Labels
area/listview 📃 Categorizes an issue or PR as relevant to the ListView control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)

Comments

@MartinZikmund
Copy link
Member

MartinZikmund commented Jan 17, 2021

Current behavior

TabView source calls UpdateLayout on one of the children of TabView. When this happens during Measure of TabListView, it causes nested call of measure, so all items are constructed twice which breaks things like selection (first item cannot be unselected). Due to the differences in control lifetime, UpdateLayout call is not needed in Uno, but the underlying issue still persists.

This may be caused by the fact that OnContainerChanging is called during the measure phase.

This problem is applicable to ListView in general, not only for TabViewListView

Expected behavior

Nested measure call should not produce duplicate set of items.

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

Uncomment tabContentPresenter.UpdateLayout() in TabView.cs and debug TabViewItemsSourceTests page. Add a breakpoint in the TabViewItem constructor and observe that it is called too many times. Also notice that first item cannot be unselected - because it is in fact just a duplicate of the actual first item.

Workaround

Environment

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):

Affected platform(s):

May be on other targets too.

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: )
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

@MartinZikmund MartinZikmund added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jan 17, 2021
MartinZikmund added a commit to MartinZikmund/Uno that referenced this issue Jan 17, 2021
- Fixes issue unoplatform#4899
- The applied Uno specific workaround is reported as issue unoplatform#4925
MartinZikmund added a commit to MartinZikmund/Uno that referenced this issue Jan 17, 2021
- Fixes issues unoplatform#4899 and unoplatform#4907
- The applied Uno specific workaround is reported as issue unoplatform#4925
@MartinZikmund MartinZikmund added project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) and removed triage/untriaged Indicates an issue requires triaging or verification labels Jan 17, 2021
MartinZikmund added a commit to MartinZikmund/Uno that referenced this issue Jan 19, 2021
- Fixes issues unoplatform#4899 and unoplatform#4907
- The applied Uno specific workaround is reported as issue unoplatform#4925
@MartinZikmund MartinZikmund removed their assignment Jan 25, 2021
@jeromelaban jeromelaban added the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Feb 15, 2021
@MartinZikmund MartinZikmund added area/listview 📃 Categorizes an issue or PR as relevant to the ListView control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jun 2, 2021
@MartinZikmund MartinZikmund changed the title Nested measure on ListView may cause duplicate items Nested measure on ListView may cause duplicate items Jul 10, 2023
@ramezgerges
Copy link
Contributor

Just tested. Doesn't seem to be a problem anymore. The constructor is called exactly 4 times in the sample page and the first tab is selected (and is selectable).

@ramezgerges ramezgerges self-assigned this Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/listview 📃 Categorizes an issue or PR as relevant to the ListView control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants