pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
762 stars 304 forks source link

Support of batching on paging v3 #2907

Closed MozzaikJD closed 9 months ago

MozzaikJD commented 9 months ago

Target environment

Browser App (Hosted external to Microsoft 365 platform)

Additional environment details

Use of V3.21.0 pnp version

Enhancement Idea

Hello everyone,

I am using PNPJS to get the users on my tenant

In basic configuration, I am using paging on user graph endpoint to limit the number of users per call. I give a CB with the "getNext" method to my UI to load the next page of users when the user click on a button. (By the way : Thanks for your reactivity on the issue #2836, how fix the paging when we use the caching)

It works well, but I have an another configuration where I specify the groups I want to get the users. So to make that, I use the batch call to get the users of each group in the single call. Like the previous configuration, I activate the paging on it to limit the number of users.

But after that I have a multiple "getNext" method to call to get the next page of users for each group. I see a ticket from v1 (in 2018) about the unsupported batching on paging in this version. I would like to know if this feature is supported in the v3 version or if it is planned to be supported in the future ?

For the moment, I will parallelize the calls to get the next page of users for each group, but it will be great if I can use the batching to get the next page of users for all groups in a single call.

Thanks for your help.

MozzaikJD commented 9 months ago

I don't know if it's a good idea but would it be possible to have a CB that will call the getNext method which will take an optional parameter GraphFi (potentially coming from the batch) which would be used for the request if it is present?

patrick-rodgers commented 9 months ago

Hi @MozzaikJD - so I get what you are trying to do, but this isn't a scenario we are looking to support in the core library at this time. You can review the paging implementation and build your own paging behavior as an option that support batching across the disconnected instances if you're so inclined. If you do, perhaps consider sharing it on the behavior patterns page or publish a package for the community to use it.

MozzaikJD commented 9 months ago

Hi @patrick-rodgers, thanks for your answer, i understand it's not the priority for the library. Like you said, i will try to implement it in my project and if it's work, i will share it on the behavior patterns page. I hope i have the time to do it before the end of the month.

patrick-rodgers commented 9 months ago

Closing this issue as answered. If you have additional questions or we did not answer your question, please open a new issue, ref this issue, and provide any additional details available. Thank you!

github-actions[bot] commented 9 months ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.

bcameron1231 commented 9 months ago

Hi. So we have a quick update on this issue. The code fix we put into place for this has caused some unforeseen issues in the library with regular caching. We are going to have to revert our fix for this in the next release... but we're actively working on a better way to fix this. Apologies, but I wanted to make sure you were aware.