SharePoint Server Subscription: Changing Look and Feel on start page very slow and errors

Marc Andre Schröder-Zhou 40 Reputation points
2023-09-20T16:45:44.7066667+00:00

I have a fresh installation of SharePoint Server Subscription Edition with no custom code or extensions. Installation status:

Microsoft SharePoint Server Subscription Edition 1031 Language Pack
16.0.14326.20450	Installed
Security Update for Microsoft SharePoint Server Subscription Edition (KB5002474)
16.0.16731.20180	Installed
Microsoft SharePoint Server Subscription Edition Core
16.0.14326.20450	Installed
Security Update for Microsoft SharePoint Server Subscription Edition (KB5002474)
16.0.16731.20180	Installed

When I try to change the color schema (look and feel) it tooks very long and at the end the system shows me a error message:

There was an error while trying to preview the theme

User's image

Browser is not useable due to long running script and in the developer console I have a lot or errors, e. g.:

Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'strict-dynamic' 'unsafe-eval' 'nonce-e8fd007f-dcf3-409d-9698-2fd1bebe8dcb'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present

Please see gif video sequence for details:

https://1drv.ms/v/s!Ais11WSLbZiroNELa-S6SnIVqamu_Q?e=EA5A0p

This happens only on the start page. Maybe it is regarding the link "get the mobile app ???

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,326 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,566 questions
0 comments No comments
{count} votes

Accepted answer
  1. Carl Joakim Damsleth 80 Reputation points
    2023-10-11T13:38:03.9433333+00:00

    We've also had similar issues at a customer, starting with the deploy of the 23H2 CU.

    There was an error when trying to preview the theme, as well as massive (10-15s) delays when navigating between sites (not between same-site pages, because theme loading is site specific), due to a bug throwing Maximum call stack size exceeded errors.

    After some digging, I found a pretty bad recursion bug in sp-pages-assembly.js?uniqueId=pxHxh, aka the 23H2 version. Specifically, the handling of the new effects and spacing theme properties, in the createTheme and spLoadTheme functions.

    The solution was to patch sp-pages-assembly, adding the effects and spacing props to the default theming object, in addition to the already present palette, fonts, semanticColors, isInverted and disableGlobalClassNames props.

    I wrote a small powershell script which quick-and-dirty does a find/replace in all sp-pages-assembly.js files in your 16-hive, which you can use if you want. Run it on all web front ends, and page loading should be a lot quicker in addition to the theme preview working.

    PS: Hacking js-files in the 16-hive is bad, and not something anyone should really do. The changes made by the script will be overwritten in the next CU from Microsoft, and by then they'll hopefully have a fix for it themselves.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 34,651 Reputation points Microsoft Vendor
    2023-09-21T06:01:13.5866667+00:00

    Hi @Marc Andre Schröder-Zhou,

    Per my research, could you check if you have used javascript:void(0); in your code? It seems the error associated with the use of the <a href='javascript:void(0)'>. Here is the article about the issue for you to refer

    https://csplite.com/csp232/

    You can also look into the following issue, it's similar with yours

    https://techcommunity.microsoft.com/t5/sharepoint/sharepoint-themes-there-was-an-error-while-attempting-to-get-the/m-p/319409


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.