SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1k forks source link

Document set navigation fails with SPFX command bar extension "Uncaught TypeError: Cannot read properties of undefined (reading 'data')" #9393

Open NerijusV opened 9 months ago

NerijusV commented 9 months ago

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

Additional environment details

Describe the bug / error

The site has document set feature enabled. Document library has document set content type. The document set has default view specified which has less columns than other views in the list. There is SPFX app with command bar extension deployed in the site (it can be sample SPFX command bar extension scaffolded using YO generator). When user navigates into document set a different view is displayed as expected. When user tries to navigate back to the library default view the error appears (most of the times). From that point all site navigation fails and user has to refresh whole page using F5.

The error show failed view rendering picture (aka. broken bicycle or dropped ice-cream). Error message: "Uncaught TypeError: Cannot read properties of undefined (reading 'data')".

Recording 2023-12-12 at 23 38 56

The console log show this error: image

If SPFX app is uninstalled this error does not occur and everything works normally as expected.

Sample SPFX app used in demo: https://github.com/NerijusV/spfx-docset-commandbar

Steps to reproduce

  1. Create document library
  2. Add some additional columns s to default view AllItems.aspx
  3. Add document set content type to the library
  4. Create new view in the library called view-docset with one column Name.
  5. Set VIEW-DOCSET as default view for document set content type.
  6. Create a few new document sets in the document library DOCSET1, DOCSET2.
  7. Scaffold new SPFX command bar extension using YO generator, deploy to App Catalog and install the app to the site.
  8. Open document library and do some navigation into DOCSET1 and DOCSET2. Notice that view is changed to view-docset when you enter the document set.
  9. Try to navigate back default view of the document library (repeat steps 9-10 a few times if error does not appear).
  10. ERROR: The error message is displayed "Uncaught TypeError: Cannot read properties of undefined (reading 'data')". The internal site navigation is broken.

Expected behavior

User should be navigated back to the list default view without error.

Additional investigation

Then SPFX command bar extension is enabled SharePoint internal list rendering tries to use some internal column caching and there is a bug, because not all columns are cached properly.

ghost commented 9 months ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.