SharePoint / SharePoint/sp-dev-docs

ListViewCommandSet: _onListViewStateChanged event returns outdated context when navigating folders

Open
#10,226 13 comments 1 reaction 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Feb 5, 2026.

area:spfx-in-lists type:bug-confirmed
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
  1. Create a ListViewCommandSet extension
  2. Handle the _onListViewStateChanged event
  3. Set up a folder structure (e.g., Root folder containing folders A, B, C, where A contains subfolders 1 and 2)
  4. Navigate from root folder into subfolder (e.g., from root into folder A/2)
  5. 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

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.