Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect / stale context.listView on updated SharePoint List UI experience (ListView Command Set) #9908

Open
1 of 9 tasks
chrisredman01 opened this issue Sep 5, 2024 · 1 comment
Labels
Needs: Triage 🔍 Awaiting categorization and initial review. type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Comments

@chrisredman01
Copy link

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.114
  • SPFx version 1.19.0
  • Node.js version v18.20.4

Describe the bug / error

When a SharePoint List is using the updated UI experience, and the list has folders enabled, the this.context.listView object is not kept in sync.

For example, this.context.listView.folderInfo.folderPath property contains the initial value when the page is loaded, but is not updated when the user clicks in to folders on the list.

The this.context.listView.rows is also stale, and only shows the items from the initial page load.

We have a ListView Command Set extension which uses the folderPath property to determine where in the list the user is when they clicked the Command Set button.

This differs to the behaviour on the 'old' modern UI.

Example:

  • First load of the list is mainly correct i.e. empty folder path as it's the root, rows = 3
    image

  • Clicking in to 'Test' folder, folder path is still empty, and we see row count of 3, rather than row count of 1
    image

  • If the page is refreshed while in the 'Test' folder, the context is correct
    image

  • Clicking 'My List' on the breadcrumb, then leaves the context stale and showing the values for the 'Test' folder still
    image

Steps to reproduce

  1. Create the default Command Set SPFx extension and update the config so it applies to Lists
  2. Change the dialog to output this.content.listView.folderInfo.folderPath and add console.log(this.context.listView)
  3. Create a SharePoint List and enable the 'New Folder' option via Advanced Settings
  4. Add items and a folder to the list
  5. Deploy the SPFx package
  6. Click in to the folder, then click the Command Set button
  7. Observe the stale context in the console
  8. Refresh the page while in the folder and click the Command Set button
  9. Observe the context is correct
  10. Click back to the root of the list using the list breadcrumb, and click the Command Set button
  11. Observe the context is stale

Expected behavior

The listView object should reflect the correct rows property and folderInfo, as it does on the 'old' modern experience.

@chrisredman01 chrisredman01 added the type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. label Sep 5, 2024
@VesaJuvonen VesaJuvonen added the Needs: Triage 🔍 Awaiting categorization and initial review. label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Awaiting categorization and initial review. type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Projects
None yet
Development

No branches or pull requests

3 participants
@chrisredman01 @VesaJuvonen and others