lbell / pretty-google-calendar

Simple WordPress plugin to embed Google Calendars in way that doesn't suck.
12 stars 7 forks source link

Stuck on "Loading..." in version 1.6.0 #28

Open lucasbacchi opened 1 year ago

lucasbacchi commented 1 year ago

Hi there! Thank you so much for your development work here!

Background

The plugin automatically updated a few days ago and suddenly the embed wouldn't load.

This is how the embed renders: image It appears to be stuck on loading and never receiving a response from the API (or never sending one... More on that later).

Troubleshooting

I started troubleshooting by looking at the logs in Google Cloud. It showed that there hadn't been any requests to the Google Calendar API in the last few days. Interestingly, there were also no errors logged. There wasn't anything in the browser console, so I didn't have much to go on, but I tried clearing caches and that didn't help. This is about when I discovered that a new version had just been released. v1.4.1 was the last version I remember having so I decided to roll back. As soon as I loaded that version back onto the server, the calendar started working again.

I've taken a look at the diff from v1.4.1 to v1.6.0 and my best guess would be that the issue has something to do with the changes that were made to the AJAX request and/or the event listener that appears to fire it. Obviously, you'd know much better so if you'd like any additional information, or if you'd like me to try any other solutions, let me know.

Site Info

It's also very possible that the theme or one of the other plugins is not playing nice with this, so I've included a list below. WordPress Version: 6.3.1 Theme: image Plugins: image

For now, I'm going to leave my site on version 1.4.1, but once you think you think you may have found the problem, I'll happily test it out for you.

lbell commented 1 year ago

Interesting... I'm not having the same issue on any of my sites. Just pushed a 1.6.1 release... maybe try that?

lucasbacchi commented 1 year ago

Nope, still broken. I tried 1.6.2 and I have the same issue. Would it be helpful for me to leave it in the broken state? I'm going to revert back to 1.4.1 for now, but I can leave it on the 1.6.2 release for a few days if that would be useful. The issue is occurring on this page at the bottom.

This is how I'm embedding it onto the page: image

Am I doing something wrong?

lbell commented 1 year ago

Not sure when I can take a deep dive into this... Don't suppose you could clone the site somewhere at a private URL and leave 1.6.2 on it?

mwguerra commented 12 months ago

Hi everyone,

I've encountered this issue at times as well. Clearing the cache usually helps in most cases.

Upon reviewing the code and conducting some tests, I've noticed that even though the pgcal script loads at the footer, the DOM is not always fully loaded when the script executes. This seems to depend on the behavior of other scripts, such as Hotjar, GTM, themes, etc.

One notable difference between the versions discussed here is that the document.addEventListener("DOMContentLoaded", …) on pgcal.js has been removed during code cleanup.

Therefore, I suggest re-embedding the code within the DOMContentLoaded event to ensure that the FullCalendar (FC) loads after the DOM has completely loaded. If needed, I can create and send a pull request. Please let me know if that works for you.

Additionally, I've experienced some inconsistent delays with the rendering of the FullCalendar. I'm currently uncertain whether this issue is related to FC itself or a call to the Google API. I will open a new issue once I have gathered more information.

Happy Halloween!

lbell commented 12 months ago

@mwguerra: Thanks for sleuthing! That makes sense. Would definitely welcome a pull request if you have a spare moment.