coralproject / talk

A better commenting experience from Vox Media
https://coralproject.net
Other
1.89k stars 358 forks source link

Coral embed is not loading for some stories #4606

Closed SadhuSantosh closed 1 hour ago

SadhuSantosh commented 5 months ago

Hey,

I am trying to add a commenting widget to the story page, but for some stories, the commenting widget is not loading, I am not sure why. I am sharing the observations below, some graphql calls are not happening for some stories

network call for embed not loading on UI

image

network call for embed loading on UI

image

Expected behavior: It should load for all the stories

Actual behavior: Widget is not loading for some stories

Versions: v9.0.3

tessalt commented 5 months ago

Hi there, unfortunately there's nothing obvious jumping out at me from these screenshots, if you have errors in the console you could share or could share your embed code we can see if there's any common issues showing up.

SadhuSantosh commented 5 months ago

Hi,

There are no errors in the browser console for any of the scenarios. Embed code I am using

 (function () {
        var d = document,
          s = d.createElement("script");
        s.src = '${coralRootUrl}/assets/js/embed.js';
        s.async = false;
        s.defer = true;
        s.onload = function () {
          var embed = Coral.createStreamEmbed({
            id: "coral_thread",
            autoRender: true,
            rootURL: coralRootUrl,
            storyID: story?.id,
            storyURL: story?.url,
            containerClassName: "coral-wrapper",
            events: function (events) {
              events.on("loginPrompt", function () {
                localStorage.setItem("isCommentsModalOpen", true);
                if (window) {
                  window.dataLayer.push({
                    event: "Some-Event"
                  });
                }

              });
            }
          });
          if (accessToken.length > 0) {
            embed.login(accessToken);
          }
          console.log("coral loaded");
        };
        (d.head || d.body).appendChild(s);
      })();
tessalt commented 5 months ago

unfortunately nothing is really jumping out at me here and we don't have the resources to debug this in depth, however you may want to investigate anything else on the page that could be modifying the display of the container element in any way.