sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

SPComponentLoader error in SPFx application extension

Open ystetsyuk opened this issue 5 years ago • 3 comments

Category

  • [x] Bug

I am using SPComponentLoader to load SP.js in SPFx application customizer:

SPComponentLoader.loadScript('/_layouts/15/init.js', {
globalExportsName: '$_global_init'
}).then( () =>{ console.log("init.js loaded"); } )

The code above works on almost all SharePoint forms & pages except this one page: https://{tenant}.sharepoint.com/site1/Docs/Forms/AllItems.aspx?id=%2Fsite1%2FDocs%2FSubfolder1%2Fsomefile%2Etxt&parent=%2Fsite1%2FDocs%2FSubfolder1

The following error is displayed in the browser console: "Uncaught (in promise) Error: No define call for /_layouts/15/init.js http://requirejs.org/docs/errors.html#nodefine".

Steps to reproduce:

  1. Upload any *.txt file to the Document library
  2. click on this file
  3. Browser window will redirect silently to URL like this: https://{tenant}.sharepoint.com/site1/Docs/Forms/AllItems.aspx?id=%2Fsite1%2FDocs%2FSubfolder1%2Fsomefile%2Etxt&parent=%2Fsite1%2FDocs%2FSubfolder1
  4. Copy and paste URL in the new browser tab
  5. The file will be opened in a browser but the error mentioned above will be displayed. Even more, I do not use SPComponentLoader on this page, and navigates to other list using left navigation (silent navigation will occur without reloading the whole browser window), then I will not be able to use SPComponentLoader there as well. The same error will be displayed there.

I am using SharePoint mod environment.

There are similar closed issues: #1180 and #2505, but the fixes do still not work for the mentioned above page.

Kind regards, Yuriy

ystetsyuk avatar Apr 13 '21 15:04 ystetsyuk

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Apr 13 '21 15:04 ghost

Thank you for your submission, but there isn't enough detail in the issue for us to review & move forward. The new issue template includes sections for you to fill out. Please resubmit your issue and complete the provided sections in the new item template so we can move forward on it refer to our wiki for more information: How to Create Good Issues

ghost avatar Apr 15 '21 10:04 ghost

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar Apr 22 '21 12:04 ghost