SharePoint / SharePoint/sp-dev-docs
onListViewUpdated() method not firing for SPFx CommandSets on Modern Page
@Ashlesha-MSFT is already working on this.
Since Apr 24, 2025.
- Dominant language
- PowerShell
- Stars
- 1.4k
- Forks
- 1.1k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 12
Description
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
- 💥 Internet Explorer
- 💥 Microsoft Edge
- 💥 Google Chrome
- 💥 FireFox
- 💥 Safari
- mobile (iOS/iPadOS)
- mobile (Android)
- not applicable
- other (enter in the "Additional environment details" area below)
Additional environment details
- browser version 128.0.6613.113 (Official Build) (64-bit)
- SPFx v1.18.2
- Node.js v18.17.1
- SharePoint tenant with Early releases enabled
Describe the bug / error
I have created a custom command set for a SharePoint list and encountered an issue where the OnListViewUpdated() method does not fire when the list component is placed on a modern SharePoint page and user select/deselect list items.
List is rendered in new modern UI in modern pages on the tenants with early releases. I tried to disable new Modern UI by setting Offline Client Availability - No, but it does not work.
Steps to reproduce
-
Create a custom command set for a SharePoint list.
-
Implement the OnListViewUpdated() method to handle visibility:
@override public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void { console.log(CustomCommandCommandSet.onListViewUpdated: Selected rows {event.selectedRows.length}`);
const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
const compareTwoCommand: Command = this.tryGetCommand('COMMAND_2');compareOneCommand.visible = event.selectedRows.length === 1;
}` -
Add the list to a modern SharePoint page.
-
Select any item in the list and observe that the OnListViewUpdated() method is not triggered. 'One Command' is still not visible.
Expected behavior
I know, onListViewUpdated() is deprecated, but it still works except in this one case, when you please a custom list on sharepoint modern page. The list renders in new Modern UI and it is not possible to turn it off there.
Will there be any updates or fixes related to the triggering of OnListViewUpdated() in the new modern UI?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.