Hi,
Like in issue 616, I'm receiving old values from the a get() involving lookups.
From my testing, it looks like the browser is caching the request.
If I make the same rest api call on another browser tab using the url, it replays me with a xml format.
And since the reply is cached on the browser I get parse errors on the original app that is expecting a JSON format.
So, it appears to me that, the sp.web call is getting the information from the browser cache instead of the SharePoint List's.
Is there a way to prevent this from happening?
I've tried using the setup but it didn't work:
sp.setup({
spfxContext: this.context,
globalCacheDisable: true,
enableCacheExpiration: true,
cacheExpirationIntervalMilliseconds: 1000
});
Please specify what version of the library you are using: [ 1.3.5 ]
Please specify what version(s) of SharePoint you are targeting: [ SharePoint Online ]
Getting a list item with lookups should return the last version of the lookup.
After updating a lookup value I receive the old values.
// Remove this if you don't have any code sample to provide
import { sp } from "@pnp/sp";
...
await sp.web.lists.getByTitle(ListName).items.getById(ID).select(
"Title",
"PM_PropNotes",
"PM_PropContract/ID",
"PM_PropContract/PM_ContStart",
"PM_PropContract/PM_ContEnd",
"PM_PropContract/PM_ContValue",
"PM_PropContract/PM_ContCurrency",
"PM_PropContract/PM_ContPeriodicity",
"PM_PropContract/PM_ContOcupation",
"PM_PropEvaluations/ID",
"PM_PropEvaluations/PM_EvDate",
"PM_PropEvaluations/PM_EvEvaluator",
"PM_PropEvaluations/PM_EvValue",
"PM_PropEvaluations/PM_EvCurrency",
"PM_PropExpenses/ID",
"PM_PropExpenses/PM_ExpDescription",
"PM_PropExpenses/PM_ExpType",
"PM_PropExpenses/PM_ExpCategory",
"PM_PropExpenses/PM_ExpEntity",
"PM_PropExpenses/PM_ExpPeriodicity",
"PM_PropExpenses/PM_ExpPaymentDate",
"PM_PropExpenses/PM_ExpExpectedValue",
"PM_PropExpenses/PM_ExpFinalValue",
"PM_PropExpenses/PM_ExpCurrency",
"PM_PropExpenses/PM_ExpStatus",
"PM_PropTasks/ID",
"PM_PropTasks/PM_TaskPropertyID",
"PM_PropTasks/PM_TaskDescription",
"PM_PropTasks/PM_TaskDeadline",
"PM_PropTasks/PM_TaskStatus",
"PM_PropRegistration/ID",
"PM_PropRegistration/Title",
"PM_PropRegistration/PM_RegValue",
"PM_PropRegistration/PM_RegCurrency",
"PM_PropRegistration/PM_RegPredialMatrix",
"PM_PropRegistration/PM_RegPredial",
"PM_PropRegistration/PM_RegEnergyCert",
"PM_PropRegistration/PM_RegDescription",
"PM_PropOwner/ID",
"PM_PropOwner/PM_OwnerName",
"PM_PropOwner/PM_OwnerContact",
"PM_PropOwner/PM_OwnerEmail"
).expand("PM_PropContract",
"PM_PropEvaluations",
"PM_PropExpenses",
"PM_PropTasks",
"PM_PropRegistration", "PM_PropOwner").get().then(async (listItem) => {
...
After farther analyzes, most of the call's are receiving the 304 code.

Hi @Dangerous-Mind,
Kind of hacky, but I usually force ignoring the browser's caching by adding unique part into the request URL, e.g. by placing additional parameter which doesn't affect on API:
import { sp } from '@pnp/sp';
import { getGUID } from '@pnp/common';
const list = sp.web.getList('/sites/site/Lists/List');
list.items.select(`*&cache=${new Date().toISOString()}`).get().then(console.log)
&cache=${new Date().toISOString()} is always unique.
I would add that this is by design. We don't do anything to automatically avoid browser cache as that is rarely optimal.
@koltyakov
I thought on doing that also.
Thanks for the reply @patrick-rodgers
I noted it was a Microsoft "By Design" thing. But its a very lousy design...
It even ignores the header of the message. If I put the request in the browser url I'll break the call in the app because It will always reply with the xml.
And since the sp.pnp can't translate the xml response it will throw a error..
I thought on contacting Microsoft but it's a useless waste of time. I'll get the "By design" reply after sending 20 fiddler logs.
I'll use the @koltyakov approach :)
Thank you both
Hi @Dangerous-Mind - unsure on a few things in your reply. But you seem angry so I wanted to try and explain a bit more.
My comment on by design referred only to this library. We in this library don't do any automatic cache manipulation as it takes that control away from the developer, user, browser, and other systems.
Finally, to be very clear, this issues list is not "contacting Microsoft". I happen to work for MSFT but this is an independent community driving project. I do this in my spare time as does everyone involved. If you have product issues with SharePoint you can also report them in the proper repo.
@patrick-rogers
Sorry. It wasn't my intention. I know you work hard on this library and I know that all the spfx community thanks you for that.
My words were only on Microsoft actions since I'm always working around many Microsoft bugs.
Thanks for you support and again, sorry if my words were not the best to use.
All good!
Most helpful comment
Hi @Dangerous-Mind - unsure on a few things in your reply. But you seem angry so I wanted to try and explain a bit more.
My comment on by design referred only to this library. We in this library don't do any automatic cache manipulation as it takes that control away from the developer, user, browser, and other systems.
Finally, to be very clear, this issues list is not "contacting Microsoft". I happen to work for MSFT but this is an independent community driving project. I do this in my spare time as does everyone involved. If you have product issues with SharePoint you can also report them in the proper repo.