this post was submitted on 11 Jan 2025
4 points (100.0% liked)

Tesseract

40 readers
2 users here now

Tesseract: An Advanced Lemmy Client

The goal of Tesseract is to address as many things in Lemmy that annoy me as I can. I also trawl various "is there any way to [blank] in Lemmy?" posts to get feature ideas. Both of those lists are pretty extensive, so Tesseract has accumulated quite a few features.

Github: https://github.com/asimons04/Tesseract/

Hosted / Demo Instance: https://tesseract.dubvee.org

Note that the hosted instance defaults to Lemmy World, but it is unlocked to be able to connect to any Lemmy server.

Announcements, support, and guidance for the Tesseract UI.

All instance rules apply here. Beyond that, just be civil and constructive.

founded 1 year ago
MODERATORS
 

Affected Versions: 1.4.21 - 1.4.28

Problem

Clicking an outside link from the feed and opening it in the same tab brings you back to an empty feed requiring a full refresh of the app.

Details

Navigating to an outside link in the same tab is treated the same as refreshing the page. This triggers, among other cleanup tasks, the memory optimizations that flush the feed, but, after navigating back from an outside link, the page is not triggering the handlers to re-create the feed.

Workaround

From the feed, click the Gear icon to load the quick settings. Enable the option "Open Links in New Tab".

Fix Status

There are a few ways to fix this, but removing the memory optimizations from the "refresh" handler is the easiest. I'm testing that in dev right now. I have other optimizations which may make these redundant, so if I am able to remove them, it both solves this issue and simplifies the code.

If those are needed, then I'm going to have to come up with another way to detect a page refresh that doesn't also trigger when navigating to an outside link (or at least some clean way to differentiate the two actions).

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 3 days ago

The root cause is that navigating away to an external site also triggers onbeforeunload which is used to detect page refresh.

There are better/official ways to detect a browser refresh. The problem is that, in Chrom(ium), SvelteKit returns 'reload' from window.performance.getEntriesByType('navigation')[0].type during normal app navigation (it returns the correct 'navigate' in FF). This causes the feed to always reset when clicking into and back from a post. Ugh.

Detecting a refresh is desired so that the feed will refresh automatically with the app/page. It's expected on mobile, for example, for a pull-down refresh to refresh the app/feed.

So, for cross-browser compatibility, sometimes the simplest answer is the correct answer:

All external links now open in a new tab, and the user setting for that has been removed. I'm basically embracing the "app" model since Tesseract is designed to be installed as a PWA.