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

SharePoint Online PermMask cached wrong in Local Browser Storage / Service Worker #9358

Open chr-sad opened 9 months ago

chr-sad commented 9 months ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

No response

Describe the bug / error

I am not sure, if this is the correct Issue-List to post this topic since it's about the SharePoint Online client side caching / API issue. We build solutions using PnP/Js (SharePoint Rest API) and use the "PermMask" information on ListItems for permission information.

Simplified calls like:

  const folderItem = await webRef.getFolderByServerRelativePath(folderServerRelativeUrl).getItem()
  const folderItemData = await folderItem.select('Id, UniqueId, PermMask').get()

In the Network-Tab we can see the request handled by SharePoint correctly without error, but the PermMask returned is not correct. E.g. the user has Permissions to upload documents to this specific folder if we have a look in SharePoint directly (UI) but if we check the permission mask, it says, the user has only read permissions.

If we then press F12 > clear the whole cache (incl. service worker) with "Application" > "Storage" > "Clear site data" and only refresh the page (no code changes) we do get the correct PermMask and everything is working again.

This issue is happening for multiple users in multiple tenants now, but not reproduceable (at least for us) and reoccuring over time even if we removed the cache once.

Is anyone experiencing the same issues?

Steps to reproduce

We cannot finally reproduce this issue in steps. The only thing which is the same for all effected users that the only solution is to clear the cache incl. service worker.

Expected behavior

If the service worker is caching the list item incl. PermMask it should handle the update of the cache correctly in every case (e.g. even if the permissions are updated by Rest API calls as well)

ghost commented 9 months ago

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

chr-sad commented 8 months ago

@nick-pape Do you know of anyone else experiencing this issue in their tenants or have any update on this issue?