Skip to content

TreeView should start with SelectedItem selected #15214

Description

@rafael-rosa-knowcode

Current behavior

When we are using TreeView and we want the selected element to start the marked TreeView, the code works for the Windows version but does not work for GTK or Wasm.

GTK.mp4

Expected behavior

The expected hehavior is to start with the SeletedItem marked.

Windows.mp4

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

Create an new Project With the Uno Wizard. (for me 5.0.17.30)
Selecte the Recommended Version.
Marque MVVM.
Create and TreeView on the Main Page.


      <muxc:TreeView ItemsSource="{Binding Elements, Mode=TwoWay}"
                     SelectedItem="{Binding SelectedElement, Mode=TwoWay}"
                     SelectionMode="Single">
        <muxc:TreeView.ItemTemplate>
          <DataTemplate x:DataType="local:ElementItem">
            <muxc:TreeViewItem IsSelected="{x:Bind IsSelected}"
                               ItemsSource="{x:Bind Children}"
                               Content="{x:Bind Name}"
                               IsExpanded="True"/>
          </DataTemplate>
        </muxc:TreeView.ItemTemplate>
      </muxc:TreeView>

And add Some information on the MainViewModel (Updating the ProjectName to yours)

using Microsoft.UI.Xaml.Controls.Primitives;

namespace UnoApp145.Presentation;

public partial class MainViewModel : ObservableObject
{
    [ObservableProperty]
    public List<ElementItem>? _elements;

    [ObservableProperty]
    public ElementItem? _selectedElement;

    private INavigator _navigator;

    [ObservableProperty]
    private string? name;

    public MainViewModel(
        IStringLocalizer localizer,
        IOptions<AppConfig> appInfo,
        INavigator navigator)
    {
        _navigator = navigator;
        Title = "Main";
        Title += $" - {localizer["ApplicationName"]}";
        Title += $" - {appInfo?.Value?.Environment}";
        GoToSecond = new AsyncRelayCommand(GoToSecondView);

        Elements = new List<ElementItem>
        {
            new ElementItem
            {
                Name = "Element 1",
                Children = new List<ElementItem>
                {
                    new ElementItem
                    {
                        Name = "SubElement 1.1",
                        Children = new List<ElementItem>
                        {
                            new ElementItem
                            {
                                Name = "SubElement 1.1.1 Selected",
                                IsSelected = true,
                                Children = new List<ElementItem>
                                {
                                    new ElementItem
                                    {
                                        Name = "SubElement 1.1.1.1",
                                        Children = new List<ElementItem>
                                        {
                                            new ElementItem
                                            {
                                                Name = "SubElement 1.1.1.1.1"
                                            },
                                            new ElementItem
                                            {
                                                Name = "SubElement 1.1.1.1.2"
                                            }
                                        }
                                    },
                                    new ElementItem
                                    {
                                        Name = "SubElement 1.1.1.2"
                                    }
                                }
                            },
                            new ElementItem
                            {
                                Name = "SubElement 1.1.2"
                            }
                        }
                    },
                    new ElementItem
                    {
                        Name = "SubElement 1.2"
                    }
                }
            },
            new ElementItem
            {
                Name = "Element 2",
                Children = new List<ElementItem>
                {
                    // ...
                }
            }
        };
        if (Elements != null && Elements.Count > 0)
        {
            SelectedElement = Elements[0].Children[0].Children[0];
        }
    }

    public string? Title { get; }

    public ICommand GoToSecond { get; }

    private async Task GoToSecondView()
    {
        await _navigator.NavigateViewModelAsync<SecondViewModel>(this, data: new Entity(Name!));
    }

}

public partial class ElementItem : ObservableObject
{
    [ObservableProperty]
    private string _name;

    [ObservableProperty]
    private bool _isSelected;

    [ObservableProperty]
    private List<ElementItem>? _children;
}

Workaround

None, for now.

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

Affected platforms

WebAssembly, Android, Skia (GTK on Linux/macOS/Windows)

IDE

No response

IDE version

Microsoft Visual Studio Community 2022 (2) (64-bit) - Current Version 17.8.3

Relevant plugins

none

Anything else we need to know?

Project reference.

UnoApp145.zip

Activity

  1. added
    kind/bug
    triage/untriaged
    difficulty/tbd
    on Jan 25, 2024
  2. added
    area/treeview 🌲
    on Jan 25, 2024
  3. Xiaoy312 commented on Jan 25, 2024

    @Xiaoy312
    Contributor
    TreeView // SelectedItem=null
    TreeViewItem // Content=SubElement 1.1.1 Selected, IsSelected=0, VisualStates=Normal||
    

    the initial binding doesnt seem to have worked for TreeView or TreeViewItem
    only the later changes from user click are pushed back onto the view-model

  4. changed the title [-]TreeView Should start with SelectedItem selected[/-] [+]`TreeView` should start with `SelectedItem` selected[/+] on Jan 29, 2024
  5. added
    project/navigation-lifecycle 🧬
    difficulty/medium 🤔
    platform/wasm 🌐
    area/skia ✏️
    and removed
    triage/untriaged
    difficulty/tbd
    on Jan 29, 2024
  6. Youssef1313 commented on Feb 1, 2024

    @Youssef1313
    Member

    The item gets selected then unselected. It's unclear why this happens.

  7. 13 remaining items

  8. Youssef1313 commented on Mar 22, 2024

    @Youssef1313
    Member

    My last investigation:

    Runtime test

    		[TestMethod]
    		public async Task When_Setting_IsSelected_TakesEffect()
    		{
    			var page = new TreeViewSelectionTestPage();
    			await UITestHelper.Load(page);
    
    			Assert.AreEqual(1, page.SelectionChangedLogs.Count);
    			Assert.AreEqual("Added: 1, Removed: 0", page.SelectionChangedLogs[0]);
    			Assert.AreEqual("SubElement 1.1.1 Selected", page.SelectedElementTextBox.Text);
    		}
    <Page
        x:Class="Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls.TreeViewSelectionTestPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    
    	<StackPanel>
    		<TextBox x:Name="SelectedElementTextBox" Text="{Binding SelectedElement.Name, Mode=TwoWay}" PlaceholderText="This is the Selected Element" x:FieldModifier="public" />
    
    		<TreeView x:Name="SUT"
    				  x:FieldModifier="public"
    				  ItemsSource="{Binding Elements, Mode=TwoWay}"
    				  SelectionChanged="TreeView_SelectionChanged"
                      SelectedItem="{Binding SelectedElement, Mode=TwoWay}"
                      SelectionMode="Single">
    			<TreeView.ItemTemplate>
    				<DataTemplate x:DataType="local:ElementItem">
    					<TreeViewItem IsSelected="{x:Bind IsSelected}"
                                 ItemsSource="{x:Bind Children}"
                                 Content="{x:Bind Name}"
                                 IsExpanded="True"/>
    				</DataTemplate>
    			</TreeView.ItemTemplate>
    		</TreeView>
    
    	</StackPanel>
    </Page>
    #nullable enable
    
    using System.Collections.Generic;
    using System.ComponentModel;
    using Microsoft.UI.Xaml.Controls;
    
    namespace Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls;
    
    public sealed partial class TreeViewSelectionTestPage : Page
    {
    	public List<string> SelectionChangedLogs { get; private set; } = new();
    
    	public TreeViewSelectionTestPage()
    	{
    		this.InitializeComponent();
    		DataContext = new TreeViewSelectionTestPageVM();
    	}
    
    	private void TreeView_SelectionChanged(TreeView sender, TreeViewSelectionChangedEventArgs args)
    	{
    		SelectionChangedLogs.Add($"Added: {args.AddedItems.Count}, Removed: {args.RemovedItems.Count}");
    	}
    }
    
    public partial class TreeViewSelectionTestPageVM : INotifyPropertyChanged
    {
    	private List<ElementItem>? _elements;
    	private ElementItem? _selectedElement;
    	private string? _name;
    
    	public List<ElementItem>? Elements
    	{
    		get => _elements;
    		set
    		{
    			if (!EqualityComparer<List<ElementItem>?>.Default.Equals(_elements, value))
    			{
    				_elements = value;
    
    				PropertyChanged?.Invoke(this, new(nameof(Elements)));
    			}
    		}
    	}
    
    	public ElementItem? SelectedElement
    	{
    		get => _selectedElement;
    		set
    		{
    			if (_selectedElement != value)
    			{
    				_selectedElement = value;
    
    				PropertyChanged?.Invoke(this, new(nameof(SelectedElement)));
    			}
    		}
    	}
    
    	public string? Name
    	{
    		get => _name;
    		set
    		{
    			if (_name != value)
    			{
    				_name = value;
    
    				PropertyChanged?.Invoke(this, new(nameof(Name)));
    			}
    		}
    	}
    
    	public event PropertyChangedEventHandler? PropertyChanged;
    
    	public TreeViewSelectionTestPageVM()
    	{
    		Elements = new List<ElementItem>
    		{
    			new ElementItem
    			{
    				Name = "Element 1",
    				Children = new List<ElementItem>
    				{
    					new ElementItem
    					{
    						Name = "SubElement 1.1",
    						Children = new List<ElementItem>
    						{
    							new ElementItem
    							{
    								Name = "SubElement 1.1.1 Selected",
    								IsSelected = true,
    								Children = new List<ElementItem>
    								{
    									new ElementItem
    									{
    										Name = "SubElement 1.1.1.1",
    										Children = new List<ElementItem>
    										{
    											new ElementItem
    											{
    												Name = "SubElement 1.1.1.1.1"
    											},
    											new ElementItem
    											{
    												Name = "SubElement 1.1.1.1.2"
    											}
    										}
    									},
    									new ElementItem
    									{
    										Name = "SubElement 1.1.1.2"
    									}
    								}
    							},
    							new ElementItem
    							{
    								Name = "SubElement 1.1.2"
    							}
    						}
    					},
    					new ElementItem
    					{
    						Name = "SubElement 1.2"
    					}
    				}
    			},
    			new ElementItem
    			{
    				Name = "Element 2",
    				Children = new List<ElementItem>
    				{
    					// ...
    				}
    			}
    		};
    
    		SelectedElement = Elements[0].Children![0].Children![0];
    	}
    }
    
    public partial class ElementItem : INotifyPropertyChanged
    {
    	private string? _name;
    	private bool _isSelected;
    	private List<ElementItem>? _children;
    
    	public string? Name
    	{
    		get => _name;
    		set
    		{
    			if (!EqualityComparer<string>.Default.Equals(_name, value))
    			{
    				_name = value;
    				PropertyChanged?.Invoke(this, new(nameof(Name)));
    			}
    		}
    	}
    
    	public bool IsSelected
    	{
    		get => _isSelected;
    		set
    		{
    			if (!EqualityComparer<bool>.Default.Equals(_isSelected, value))
    			{
    				_isSelected = value;
    				PropertyChanged?.Invoke(this, new(nameof(IsSelected)));
    			}
    		}
    	}
    
    	public List<ElementItem>? Children
    	{
    		get => _children;
    		set
    		{
    			if (!EqualityComparer<List<ElementItem>?>.Default.Equals(_children, value))
    			{
    				_children = value;
    				PropertyChanged?.Invoke(this, new(nameof(Children)));
    			}
    		}
    	}
    
    	public event PropertyChangedEventHandler? PropertyChanged;
    }

    Findings

    For the above runtime test, this line causes itemNodeImplNoRef.SelectionState to change in Uno, but not in WinUI.

    This line is important, and delaying it simply doesn't work. So, I'm suspecting TreeViewList to be really relying on some behavior up in the hierarchy that's not aligned in Uno.

  9. nickrandolph commented on Apr 3, 2024

    @nickrandolph
    Contributor

    @Xiaoy312 @Youssef1313 @jeromelaban can we get an update on where we're at with this?

  10. jeromelaban commented on Apr 3, 2024

    @jeromelaban
    Member

    @nickrandolph still in progress.

  11. Xiaoy312 commented on Apr 6, 2024

    @Xiaoy312
    Contributor

    [ios]When_SelectedItem_Expanded(111, False)

    callstack
    00 SamplesApp.iOS.Application.Main at D:\code\uno\framework\uno\src\SamplesApp\SamplesApp.netcoremobile\iOS\Main.iOS.cs:12,4
    01 UIKit.UIApplication.Main
    02 UIKit.UIApplication.UIApplicationMain
    03 UIKit.UIApplication.xamarin_UIApplicationMain
    04 CoreFoundation.DispatchQueue.static_dispatcher_to_managed
    05 Uno.UI.Dispatching.NativeDispatcher.DispatchItems at D:\code\uno\framework\uno\src\Uno.UI.Dispatching\Native\NativeDispatcher.cs:131,7
    06 Microsoft.UI.Xaml.Controls.TreeViewItem. at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewItem.cs:792,4
    07 Microsoft.UI.Xaml.Controls.TreeViewNode.set_IsExpanded at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewNode.Properties.cs:32,10
    08 Microsoft.UI.Xaml.Controls.TreeViewNode.SetValue at D:\code\uno\framework\uno\src\Uno.UI\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.DependencyObject.DependencyObjectGenerator\Microsoft.UI.Xaml.Controls.TreeViewNode_521ca4b7e62bcc2696ff11454b229c27.cs:64,64
    09 Microsoft.UI.Xaml.DependencyObjectStore.SetValue at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:393,4
    10 Microsoft.UI.Xaml.DependencyObjectStore.SetValue at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:439,5
    11 Microsoft.UI.Xaml.DependencyObjectStore.InnerSetValue at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:513,6
    12 Microsoft.UI.Xaml.DependencyObjectStore.RaiseCallbacks at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:1822,5
    13 Microsoft.UI.Xaml.DependencyObjectStore.InvokeCallbacks at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:1918,4
    14 Microsoft.UI.Xaml.PropertyMetadata.RaisePropertyChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\PropertyMetadata.cs:192,4
    15 Microsoft.UI.Xaml.Controls.TreeViewNode.OnIsExpandedPropertyChanged at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewNode.Properties.cs:60,3
    16 Microsoft.UI.Xaml.Controls.TreeViewNode.OnPropertyChanged at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewNode.cs:110,3
    17 Microsoft.UI.Xaml.Controls.TreeViewViewModel.TreeViewNodePropertyChanged at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewViewModel.cs:894,4
    18 Microsoft.UI.Xaml.Controls.TreeViewViewModel.TreeViewNodeIsExpandedPropertyChanged at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewViewModel.cs:915,6
    19 Microsoft.UI.Xaml.Controls.TreeViewViewModel.AddNodeToView at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewViewModel.cs:363,3
    20 Microsoft.UI.Xaml.Controls.TreeViewViewModel.Insert at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewViewModel.cs:256,57
    21 Microsoft.UI.Xaml.Controls.TreeViewViewModel.InsertAt at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeViewViewModel.cs:247,3
    22 Windows.Foundation.Collections.ObservableVector<object>.Insert at D:\code\uno\framework\uno\src\Uno.Foundation\Collections\Internal\ObservableVector.cs:61,3
    23 Windows.Foundation.Collections.ObservableVector<object>.RaiseVectorChanged at D:\code\uno\framework\uno\src\Uno.Foundation\Collections\Internal\ObservableVector.cs:91,3
    24 Microsoft.UI.Xaml.Controls.ItemCollection. at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\ItemCollection.cs:260,6
    25 Microsoft.UI.Xaml.Controls.ItemCollection.OnItemsSourceVectorChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\ItemCollection.cs:306,4
    26 Uno.UI.Extensions.VectorChangedEventHandlerExtensions.TryRaise at D:\code\uno\framework\uno\src\Uno.UI\Extensions\VectorChangedEventHandlerExtensions.cs:16,4
    27 Microsoft.UI.Xaml.Controls.ItemsControl.OnItemsVectorChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\ItemsControl\ItemsControl.cs:109,4
    28 Microsoft.UI.Xaml.Controls.ListViewBase.OnItemsSourceSingleCollectionChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\ListViewBase\ListViewBase.cs:838,4
    29 Microsoft.UI.Xaml.Controls.Primitives.Selector.OnItemsSourceSingleCollectionChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\Primitives\Selector.cs:521,7
    30 Microsoft.UI.Xaml.Controls.Primitives.Selector.set_SelectedIndex at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\Primitives\Selector.cs:264,11
    31 Uno.UI.Controls.BindableUIView.SetValue at D:\code\uno\framework\uno\src\Uno.UI\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.DependencyObject.DependencyObjectGenerator\Uno.UI.Controls.BindableUIView_283f42f32036f7bd27e98620585dab23.cs:65,64
    32 Microsoft.UI.Xaml.DependencyObjectStore.SetValue at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:393,4
    33 Microsoft.UI.Xaml.DependencyObjectStore.SetValue at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:439,5
    34 Microsoft.UI.Xaml.DependencyObjectStore.InnerSetValue at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:513,6
    35 Microsoft.UI.Xaml.DependencyObjectStore.RaiseCallbacks at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:1822,5
    36 Microsoft.UI.Xaml.DependencyObjectStore.InvokeCallbacks at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:1928,5
    37 Uno.UI.Controls.BindableUIView.Microsoft.UI.Xaml.IDependencyObjectInternal.OnPropertyChanged2 at D:\code\uno\framework\uno\src\Uno.UI\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.DependencyObject.DependencyObjectGenerator\Uno.UI.Controls.BindableUIView_283f42f32036f7bd27e98620585dab23.cs:71,123
    38 Microsoft.UI.Xaml.Controls.Primitives.Selector.OnPropertyChanged2 at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\Primitives\Selector.cs:77,5
    39 Microsoft.UI.Xaml.Controls.ListViewBase.OnSelectedIndexChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\ListViewBase\ListViewBase.cs:460,4
    40 Microsoft.UI.Xaml.Controls.Primitives.Selector.OnSelectedIndexChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\Primitives\Selector.cs:344,6
    41 Microsoft.UI.Xaml.Controls.Primitives.Selector.InvokeSelectionChanged at D:\code\uno\framework\uno\src\Uno.UI\UI\Xaml\Controls\Primitives\Selector.cs:257,5
    42 Microsoft.UI.Xaml.Controls.TreeView.OnListControlSelectionChanged at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeView.cs:324,4
    43 Microsoft.UI.Xaml.Controls.TreeView.RaiseSelectionChanged at D:\code\uno\framework\uno\src\Uno.UI\Microsoft\UI\Xaml\Controls\TreeView\TreeView.cs:396,3
    44 Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls.Given_TreeView.<>c.<When_SelectedItem_Expanded_AsdAsd2>b__10_1 at D:\code\uno\framework\uno\src\Uno.UI.RuntimeTests\Tests\Microsoft_UI_Xaml_Controls\Given_TreeView.cs:241,5
    
    @22: insert(index=2, item=111) // after: _list[5]: [1,11,111,12,2]
    @28: args: { NewStartingIndex=2, NewItems=[null], OldStartingIndex=-1, OldItems=null }
    @29:
        var selectedIndexToSet = SelectedIndex; // 2; note this value was mutated below
        base.OnItemsSourceSingleCollectionChanged(sender, c, section);
        switch (c.Action)
            case NotifyCollectionChangedAction.Add:
                //Advance SelectedIndex if items are being inserted before it
                var newIndex = GetIndexFromIndexPath(Uno.UI.IndexPath.FromRowSection(c.NewStartingIndex, section)); // 2: f(2,0);
                if (selectedIndexToSet >= newIndex) // true: 2 >= 2
                    selectedIndexToSet += c.NewItems.Count; // 3: 2 += 1
                    SelectedIndex = Math.Min(NumberOfItems - 1, selectedIndexToSet); // 3: min(5-1, 3)
    	^ doesnt look right here..?
    
  12. nickrandolph commented on Apr 8, 2024

    @nickrandolph
    Contributor

    [ios]When_SelectedItem_Expanded(111, False)

    callstack

    @22: insert(index=2, item=111) // after: _list[5]: [1,11,111,12,2]
    @28: args: { NewStartingIndex=2, NewItems=[null], OldStartingIndex=-1, OldItems=null }
    @29:
        var selectedIndexToSet = SelectedIndex; // 2; note this value was mutated below
        base.OnItemsSourceSingleCollectionChanged(sender, c, section);
        switch (c.Action)
            case NotifyCollectionChangedAction.Add:
                //Advance SelectedIndex if items are being inserted before it
                var newIndex = GetIndexFromIndexPath(Uno.UI.IndexPath.FromRowSection(c.NewStartingIndex, section)); // 2: f(2,0);
                if (selectedIndexToSet >= newIndex) // true: 2 >= 2
                    selectedIndexToSet += c.NewItems.Count; // 3: 2 += 1
                    SelectedIndex = Math.Min(NumberOfItems - 1, selectedIndexToSet); // 3: min(5-1, 3)
    	^ doesnt look right here..?
    

    @Xiaoy312 are you looking for a response on this?

  13. Xiaoy312 commented on Apr 8, 2024

    @Xiaoy312
    Contributor

    not really, at least not yet, though any input is appreciated
    it is just a quick note

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/skia ✏️area/treeview 🌲difficulty/challenging 🤯kind/bugplatform/wasm 🌐project/items 🧾

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions