3

I'm getting the error: The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

When using:

 private _jeSelectPermission = async () => {
     try{
     const ler = await sp.web.lists.ensure("MyList");
     const list: IList = ler.list;
    
     await list.roleAssignments();
     const user = await sp.web.currentUser();
    
     const ReadroleDefinition = await sp.web.roleDefinitions.getByName("Read").get();
    console.log("roleDefinition : ", ReadroleDefinition);
                
    await sp.web.lists.getByTitle('MyList').items.getById(this.state.JEId).roleAssignments.add(user.Id, ReadroleDefinition.Id);
    const info = await sp.web.lists.getByTitle('MyList').items.getById(this.state.JEId).roleAssignments(); 
    console.log(info);
     } catch(error){
       console.log(error);
     }
        
   }

It works initially, so if I set permissions onto several items one by one, it works, but then starts to show these errors, or actually doesn't show the errors in the console and fail to add the permissions. Any ideas?

NightTom
  • 418
  • 15
  • 37
  • I'm having the same issue, did you solved it? – Or Assayag Feb 08 '21 at 10:15
  • 1
    I did solve it, but can't remember exactly how. I think it was something to do with sp/pnp and how it was set up in the root ts file for the webpart. I updated it to: ``` export default class EiaWebPart extends BaseClientSideWebPart { protected onInit(): Promise { sp.setup({ spfxContext: this.context }); return super.onInit(); } ``` – NightTom Feb 08 '21 at 10:22

0 Answers0