sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Command Set bug with Select All checkbox: Cannot read property 'peek' of undefined

Open semopz opened this issue 8 years ago • 4 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

When a command set extension is deployed to a list with more than 100 items, selecting all items using the select all checkbox in the ListView header should not cause the page/view to malfunction. The command set buttons should be functional if the "Select All" checkbox has been used without refreshing the page.

Observed Behavior

First I'd like to define when I consider that the command set extension has loaded. When I see the following 3 lines in the console, I assume that my extension has loaded:

Added 2 custom actions to RibbonDoc
Added 2 custom actions to RibbonList
Finished loading extensions for all custom actions

After the issue has occurred

  • My custom action button does not function as expected. Some functions work, others don't. It is very strange and hard to debug.

  • An error might flash on the page (paper plane, ice cream cone) for a fraction of a second regarding the 'peek' undefined error.

The page must be reloaded before things go back to normal.

I've found the issue to present itself in mainly 3 different ways (but it is sometimes inconsistent). You must have a library with around 100 documents where the extension is deployed to reproduce the issue:

  1. Click on the Select All circle checkbox as soon as it is available: You will see an exception object an error message

TypeError: Cannot read property 'properties' of undefined at spoapp-mini-e7480f12.js:1 at Array.forEach () at spoapp-mini-e7480f12.js:1 at r.then (spofiles-mini-4c8eb087.js:1) at n.e.raiseListChangeEvent (spoapp-mini-e7480f12.js:1) at spofiles-mini-4c8eb087.js:1 at Object.w (knockout-mini-1cb4a7a0.js:6) at i (spofiles-mini-4c8eb087.js:1) at e.ignore (spofiles-mini-4c8eb087.js:1) at e._onSelectionChange (spofiles-mini-4c8eb087.js:1)

Error before extension loaded

  1. Wait for the command set extension to load and Select All now the error is logged slightly differently in the console but it is the same error Error after extension loaded

  2. This time, make sure you have only a few folders in the root and move all documents in one of the folders. When in the root, Select All (so all folders). The error will now appear after you click on the folder with the 100+ documents.

if you are unlucky, you will eventually get this error and your extension won't load anymore:

Refused to load the script 'https://r4.res.office365.com/footprint/v2.6/scripts/fp.js' because it violates the following Content Security Policy directive: "script-src 'self' https://contentstorage.osi.office.net https://swx.cdn.skype.com https://res.delve.office.com https://lpcres.delve.office.com https://static.sharepointonline.com https://widget.uservoice.com https://by2.uservoice.com https://www.bing.com/api/maps/ https://www.bing.com/rms/ https://spoprod-a.akamaihd.net https://publiccdn.sharepointonline.com https://spoprod-a.akamaihd.net/files/odsp-next-prod_2018-10-19-sts_20181024.001/ https://r1.res.office365.com https://webshell.suite.office.com https://shellux.msocdn.com https://shellprod.msocdn.com https://shellppe.msocdn.com https://c1-excel-15.cdn.office.net https://contentstorage.osi.office.net https://c1-visio-15.cdn.office.net https://c1-word-view-15.cdn.office.net 'unsafe-eval' 'nonce-9941ea38-58c9-41a2-b3aa-a32fec0d942d'".

When that happens, I normally do gulp clean/serve. Shift selecting 100+ items seems to be fine

Steps to Reproduce

  1. Run yo @microsoft/sharepoint and provide the following answers a. commandset-test-bug b. SharePoint Online only c. Create a subfolder with solution name d. N e. Extension f. ListView Command Set g. whatever h. whatever
  2. cd commandset-test-bug\
  3. Create a library and upload at least 100 documents to it
  4. Update pageUrl with the library’s URL in config\serve.json
  5. Gulp serve
  6. Load Script when browser pops up
  7. Click on the Select All circle checkbox
  8. Observe error in console

semopz avatar Oct 29 '18 15:10 semopz

SharePoint only allow to select a maximum of 100 items at the same time to bulk operate. Please refer to this link: https://docs.microsoft.com/en-us/SharePoint/install/software-boundaries-and-limits-0 100itemsselected

vmiy avatar Nov 09 '18 07:11 vmiy

  1. I'm not selecting more than 100 items. By default in modern view will only load 92 items
  2. I can select more than 100 items if I select the items individually or using shift select. The problem occurs only when the select all circle checkbox is click in a modern view
  3. There is no such issue if a default command set is not deployed to the site already

semopz avatar Nov 09 '18 08:11 semopz

Any chance of this getting fixed by 1.7.1 or could someone suggest a workaround? This is a pretty serious issue as users can break their view even without using the deployed extension(s).

Also, what does the tracked label mean?

semopz avatar Dec 03 '18 11:12 semopz

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 26 '20 06:01 msft-github-bot