SharePoint / SharePoint/sp-dev-docs

onListViewUpdated() method not firing for SPFx CommandSets on Modern Page

Open
#9,898 20 comments 1 reaction 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Apr 24, 2025.

area:spfx area:spfx-extensions Needs: Author Feedback Needs: Triage :mag: sharepoint-developer-support type:bug-suspected
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
  1. Create a custom command set for a SharePoint list.

  2. 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;
    }`

  3. Add the list to a modern SharePoint page.

  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.