4

After migration from Sitecore 8.2 Update-5 to Sitecore 9 Update-1 I see JavaScript error in Experience Editor mode.

For example:

I have a content page. Under content page I'm storing datasource items. Content page has some components which are using these datasource items. After changing datasource data in Experience Editor and clicking Save button I see error in browser console (Chrome, IE, FF):

> 16349168387717799575.JS:957 Uncaught TypeError: Cannot read property 'context' of undefined
>     at Object.showPublishAffectedPagesNotification (16349168387717799575.JS:957)
>     at 16349168387717799575.JS:939
>     at ExperienceEditor.js:142
>     at Object.onRequestProcessorSuccessCallback (ExperienceEditor.js:1015)
>     at Object.success (ExperienceEditor.js:990)
>     at fire (jquery-2.1.1.js:3073)
>     at Object.fireWith [as resolveWith] (jquery-2.1.1.js:3185)
>     at done (jquery-2.1.1.js:8251)
>     at XMLHttpRequest.<anonymous> (jquery-2.1.1.js:8598)
>     at Object.send (jquery-2.1.1.js:8623)

Please, help me to resolve this issue.

7
  • can you compare ExperienceEditor.js with same file from a clean solution – Vlad Iobagiu Apr 12 '18 at 17:18
  • I’ve just compared files. They are the same. No any difference. – Andrei Paliakou Apr 12 '18 at 20:49
  • Something is different after your upgrade, file wise. Can you use Beyond Compare and compare your bin folder and /Sitecore folder to a clean install. See if you can see any major differences. – Chris Auer Apr 14 '18 at 19:22
  • 1
    Just wondering if you resolved this @AndreiPaliakou - have seen the same come up on our Sitecore 9 Update 1 installation. We've been running this for a while though and not seen before. Seems to come up for us though when the page loads in the Experience Editor. – Andy Butland Jul 31 '18 at 15:17
  • 1
    @chilly I was able to resolve this issue. Check my answer. – Andrei Paliakou Apr 15 '20 at 15:05
1

I was able to resolve this issue.

You will need to change sitecore\shell\client\Sitecore\ExperienceEditor\Commands\ShowDataSources.js.

Search for line:

this.command.context.app.showNotification("notification", notificationTitle, true);

and replace it with:

this.commandContext.app.showNotification("notification", notificationTitle, true);

After this fix console error will not appear and you should able to see Experience Editor notification:

enter image description here

Update:

In Sitecore 9.3 it was fixed like:

showPublishAffectedPagesNotification: function (context) {
      var notificationTitle = TranslationUtil.translateTextByServer(TranslationUtil.keys.This_component_contains_associated_content_If_you_publish_this_component_the_associated_content_is_also_published_to_a_number_of_other_pages_that_use_the_same_associated_content, ExperienceEditor);
      // notificationTitle = notificationTitle.replace("{0}", result.inFinalStateCountAndNotPublished);
      var currentContext = context.context || context;
      currentContext.app.showNotification("notification", notificationTitle, true);
    },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.