SharePoint / SharePoint/sp-dev-docs
ListViewCommandSet: _onListViewStateChanged event returns outdated context when navigating folders
@Ashlesha-MSFT is already working on this.
Since Feb 5, 2026.
- 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: 135.0.3179.98
- SPFx version: 1.19.0
- Node.js version: v18.20.2
- Operating System: Windows 11
Describe the bug / error
When using a ListViewCommandSet extension and handling folder navigation through the _onListViewStateChanged event, we've identified that the context (specifically context.listView.rows) returns outdated data.
When navigating into a subfolder, the context.listView.rows in _onListViewStateChanged still contains the items from the parent folder (A, B, C) instead of the current folder's content (1, 2).
Note: We've identified that adding a significant delay (e.g., setTimeout) eventually shows the correct content, indicating this might be a timing/synchronization issue with the context update.
Steps to reproduce
- Create a ListViewCommandSet extension
- Handle the _onListViewStateChanged event
- Set up a folder structure (e.g., Root folder containing folders A, B, C, where A contains subfolders 1 and 2)
- Navigate from root folder into subfolder (e.g., from root into folder A/2)
- Check the context.listView.rows content in the _onListViewStateChanged event
Expected behavior
The context.listView.rows should reflect the current folder's content when _onListViewStateChanged is triggered.
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.