Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetWssIdForTermAsync returns wrong WssId if used multiple times on the same PnPContext instance #1355

Closed
1 task done
FlorianLabranche opened this issue Jan 18, 2024 · 3 comments
Assignees
Labels
area: model 📐 Related to the core SDK models bug Something isn't working

Comments

@FlorianLabranche
Copy link

Category

  • Bug

Describe the bug

Using the same instance of PnPContext, if we call GetWssIdForTermAsync multiple times for different Term Ids, it will return the lowest WssId.

Steps to reproduce

  • Call GetWssIdForTermAsync for a term id
    var wssId = await PnPContext.Web.GetWssIdForTermAsync("9a75fe52-df53-4308-ad8d-dde6ee58376c");
    This term returns a WssId of 19
    image
  • Call GetWssIdForTermAsync for a term having a WssId greater than the first one
    var wssId = await PnPContext.Web.GetWssIdForTermAsync("fd24f190-c115-4258-b337-7997f8e00a6c");
    This term will still returns a WssId of 19 despite it should be 20.
    image

Expected behavior

GetWssIdForTermAsync should return the correct WssId.
Issue is caused by the implementation still having previous listItems cached.
image

Environment details (development & target environment)

  • SDK version: 1.10 and 1.11
  • OS:Windows 10
  • SDK used in: Azure Function Apps
  • Framework: .NET 6
  • Browser(s): N/A
  • Tooling: Visual Studio 2022
@FlorianLabranche
Copy link
Author

I temporary fixed this by cloning the context.
var wssId = await (await PnPContext.CloneAsync()).Web.GetWssIdForTermAsync(term.Id);

@jansenbe jansenbe self-assigned this Jan 18, 2024
@jansenbe jansenbe added bug Something isn't working area: model 📐 Related to the core SDK models labels Jan 18, 2024
jansenbe added a commit that referenced this issue Jan 18, 2024
@jansenbe
Copy link
Contributor

@FlorianLabranche : just pushed a fix, will be part of the next nightly. Please test tomorrow and close this issue if things work for you.

@FlorianLabranche
Copy link
Author

@jansenbe tested and approved, next time, I should try to do a PR 😀
Thanks for the quick support !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: model 📐 Related to the core SDK models bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants