Pnpjs: Implement caching for permissions APIs

Created on 24 Oct 2018  路  3Comments  路  Source: pnp/pnpjs

Category

  • [X] Enhancement
  • [ ] Bug
  • [ ] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: [1.2.1]

Please specify what version(s) of SharePoint you are targeting: [2013]

Expected / Desired Behavior / Question

It would be nice if the permissions APIs (e.g. getCurrentUserEffectivePermissions) could be cached, similar to the other APIs. Permissions don't frequently change, so this seems like a perfect case for one less resource.

code in progress bug

Most helpful comment

Circling back to this it turns out to be a bigger deal than I thought. Essentially any method that uses clone loses the caching flag. That's a pretty big bug, but luckily the impact is just more web traffic and not broken applications. I am in the process of fixing this and will have a PR in today that will be part of the Friday release.

All 3 comments

Did you try this with usingCaching() ? I don't immediately see a reason this wouldn't work.

What would the syntax be? When I've used the other APIs with usingCaching, I'll grab the resource (e.g. items), then usingCaching, then get. With getCurrentUserEffectivePermissions (etc), the method is the executor of the asynchronous request (rather than get), so there's not the opportunity to use usingCaching that I can see.

Circling back to this it turns out to be a bigger deal than I thought. Essentially any method that uses clone loses the caching flag. That's a pretty big bug, but luckily the impact is just more web traffic and not broken applications. I am in the process of fixing this and will have a PR in today that will be part of the Friday release.

Was this page helpful?
0 / 5 - 0 ratings