I recently rewrote the methods the forum uses to display embedded Tweets. In the past all of the embeds on forum page were rendered upon page load. This made topics with many Tweets appear very slowly for users. The new method lazy-loads embedded Tweets. It only fetches them if they are on-screen or close to being on-screen as you scroll through a topic. There's an animated 'Tweet loading' spinner image as a placeholder to let you know that a Tweet is being fetched.
Please let me know if you encounter any problems with this new code. It should work in all modern browsers. It won't work in Internet Explorer. (If you're using IE to browse the internet these days you should have your head examined.)
If you happen to see a tweet that never loads, the spinner just keeps spinning, it's likely because the account associated with the tweet has been suspended. We only refresh the status availability of tweets once every 30 days.
Acutally I never understood why the tweets posted in a thread seem to "disappear" after a while. Did I get it right that it just takes a while to reload?
The "disappearing" could have been just waiting for it to load. Some forum pages might have 25+ tweets embedded in posts. With the old scheme they would all need to load (slowly) before the page became responsive for users. It was very inefficient. The new scheme only loads Tweets that are visible on-screen or close to being displayed if you are scrolling. It's not perfect and sometimes has delays. Twitter also doesn't provide any kind of error reporting with this method to tell us a Tweet is no longer available. That's why sometimes the spinner will keep on spinning.
Twitter doesn't want sites hammering their servers loading data over and over. They want sites to store some of the Tweet info locally. They provide a variable "time to live" (TTL) value for this Tweet data. We kinda ignore the TTL and only refresh Tweets once every 30 days. Tweets go away for lots of reasons: the Twitter user deletes a Tweet, their Twitter account is banned/suspended, etc. Lots of adult entertainment Twitter accounts get banned by Twitter for violating their terms of service. That's the primary reason for many of the Tweets here in the forum going to some version of "unavailable".
The lazy loading feature requires IntersectionObserver support in the browser. That was added in Firefox for Android v 83 released on November 16th 2020. Do you know if you're running that version or newer?
Edited to add: I just downloaded and installed Firefox from the Google Play Store and it appears to be properly lazy-loading tweets.
I'm using the same version on stock Android/Pixel3a.
I'll do a little tinkering. I'm not logged into twitter for the web on my phone which makes the Tweets render as though I'm an anonymous Twitter user without an account. (I don't even have the Twitter app on my phone.) I'm curious if there's a bug in the Twitter JS libraries that render Tweets with their API.
I figured it out. It was the Enhanced Tracking Protection but there are different levels. For some reason, my default Protection was on Strict for Android and was on Standard for Desktop.
I have attached the settings for Desktop for you to look for under Options under Privacy & Security:
I've updated the way the Tweet loading spinner works today. It's now a clickable element. So you can click it and see why the Tweet didn't load. Likely due to suspended accounts or privacy restrictions.
I've updated the code that interfaces with Twitter's API to check the status responses for private tweets and suspended accounts. We should start to see them get cleaned up soon.
I'm having 5-10 second delays loading up tweets now. I fiddled around with my firefox settings like the enhanced protection but it's not making a difference. I checked Chrome, and it's not happening there.
I'm experiencing the same thing (also suing firefox). I thought initially it was due to the amazon web services problems from a couple days ago, but it's still happening.
It's working normally for me in FF 95. I have the Enhanced Tracking Protection set as "Standard". If you're not using standard could you send me a PM with your settings so I can try to replicate the issue and study it? I tinkered with some of the other Enhanced Tracking Protection options and most of them seem to block Twitter's widgets file completely which will cause Tweets to not render at all. I'm not able to figure out which setting makes them render slowly.
I have mine on standard too. I suspect it is one of the non-customisable part of the extended protection settings. Either that or turning it off on the ADT domain doesn't impact how it sees the twitter api.
I'm seeing the slow loading of the Tweets in FF now in the Gia OhMy topic. I switched to my tethered Verizon connection and they are loading very slowly. Not sure why. If I switch back to Starlink things load quickly.
Watching the waterfall in the network tab using a developer tools window shows the delay appears to be happening within Twitter's code that inserts and inline Iframe and renders the tweet within the forum page.
I use the Intersection Observer API to lazy-load the Tweets as a user scrolls down the page. I'm going to see if maybe the new version of FF has a slightly different IO API implementation and is slow to detect the tweet placeholder moving into the visible area before firing the event that loads the Tweet content.
edited to add:
I've watched the page loading more closely. The Twitter script that injects the embedded Tweet iframe's CSS & html is loading very quickly. Something in FF is preventing the resources in that iframe from being fetched and rendered quickly. I'll take a look at it a bit more but at the moment I don't think there's much I can do to speed it up because the scripts that load the Tweet content come from Twitter's servers.