Open SPJS opened 3 weeks ago
Thank you @SPJS for reporting! We're working on a fix. In the meantime, selecting and de-selecting an item in the list you navigated to should reset those commands.
Great - I have one related issue that you might want to look into also. If you navigate between lists, the _onListViewStateChanged function is called multiple times when you go to select an item. It seems the listViewStateChangedEvent is not removed when you navigate to another list - effectively adding another call to that function for every new list you navigate to.
To recreate this you can modify the hello-world example and add this console.log:
Now click between List_A and List_B a few times using the quicklaunch link and then click to select a list item - it will console.log one line for every time you changed the list:
Alexander
@SPJS Thanks! We'll take a look.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
đź’Ą SharePoint Framework
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
Please note that my tenant is on Targeted release.
Describe the bug / error
When a SharePoint list is using the updated UI experience the this.context.listView.selectedRows object refers to the selected item ID in the previous list when you navigate to another list using the quick launch menu.
This example uses the hello-world Command Set SPFx: https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api
If you first open List_A, select an item and click the Command One button:
This outputs the following to the console:
If you then navigate to List_B using the quick launch menu, the Command One button is visible even though no items are selected (or exist for that matter) in List_B:
There are no items in List_B to select, but the console outputs the previous selected item from List_A
If List_B does contain items and there is an item with the same ID as the selected item in List_A, this item will be listed in the console even if it is not actually selected in the list view:
Steps to reproduce
I changed the hello-world example like this:
Expected behavior
The this.context.listView.selectedRows object should be reset when you navigate to another list.