Puzzlepart / prosjektportalen365

Prosjektportalen for Microsoft 365
MIT License
29 stars 16 forks source link

Default aggregation pages in prosjektportalen will fail to load under certain conditions #668

Closed okms closed 2 years ago

okms commented 2 years ago

Describe the bug Default aggregation pages in prosjektportalen will fail to load when certain preconditions are met. This fault is reproduceable in any tenant and presumably any browser.

To Reproduce

Preconditions:

CleanShot 2022-03-21 at 14 51 52

  1. Go to the pp365 portfolio hub
  2. Perform the following in the same tab
  3. Click on 'Porteføljeoversikt', let the page load
  4. Click on 'Prosjektoversikt', let the page load
  5. Click on 'Porteføljeinnsikt', let the page load

Expected behavior Each page loads without error

Observed behavior Page loading crashes after the 2nd or 3rd page. When reviewing the console the following error is printed

portfolio-aggregation-web-part_b138a2a3ceedaeddaf99.js:1 Message: Failed to execute 'setItem' on 'Storage': Setting the value of 'PnPjs.SearchWithCaching(1230701932)' exceeded the quota. Data: {"stack":"Error: Failed to execute 'setItem' on 'Storage': Setting the value of 'PnPjs.SearchWithCaching(1230701932)' exceeded the quota.\n at e.put (https://tenantname.sharepoint.com/sites/AppCatalog/ClientSideAssets/00483367-68e2-4977-9cc3-6cf0de623daa/portfolio-aggregation-web-part_b138a2a3ceedaeddaf99.js:1:97574)\n at e.cacheData (https://tenantname.sharepoint.com/sites/AppCatalog/ClientSideAssets/00483367-68e2-4977-9cc3-6cf0de623daa/portfolio-aggregation-web-part_b138a2a3ceedaeddaf99.js:1:371563)\n at https://tenantname.sharepoint.com/sites/AppCatalog/ClientSideAssets/00483367-68e2-4977-9cc3-6cf0de623daa/portfolio-aggregation-web-part_b138a2a3ceedaeddaf99.js:1:371450"}

About your setup

Additional context The error is caused by local storage exceeding the availiable quota. On our end this is happening here

https://github.com/Puzzlepart/prosjektportalen365/blob/3366f13fc105e3f1cb73617129fa35017637f5ae/SharePointFramework/PortfolioWebParts/src/data/index.ts#L503

We are not supplying any ICachingOptions to sp.searchWithCaching which we could look into, e.g. supplying page name or as key. This is worth investigating, turning off caching or adding error handling which flushes local storage are other options. We are currently on v. 1.x of pnpjs, which is a rather old version, searchWithCaching has been removed in 3.x in favour of separate caching settings.

A workaround is to open each page in a separate tab, i assume this is because the default caching behaviour in our version of pnpjs is to use session caching.

cc: @pzljanb @tarjeieo @olemp

olemp commented 2 years ago

I propose we skip the caching. 💨

olemp commented 2 years ago

@pzljanb @tarjeieo @Petterandre We might need to push this to 1.5.1 or later. We have limited time this week if we want to release this Friday.