ReVanced / revanced-website

🌐 Website for ReVanced
https://revanced.app
GNU General Public License v3.0
279 stars 43 forks source link

feat: remove Svelte Query #217

Open KTibow opened 5 months ago

KTibow commented 5 months ago

As discussed on Discord, the use of Svelte Query is problematic. It doesn't even do much other than wrap some functions.

We should move these to load functions. These run on the server, letting us provide data to non-JS users and prevent layout shifts.

The only problem is that we currently build statically, and if we move to using the CF Pages adapter we start running into the 100k daily worker limit. It has still yet to be investigated if we can only run the worker on some pages.

oSumAtrIX commented 5 months ago

I'd say moving JS to the server for the gain of satisfying non JS users of the site is not worth it, considering the issue you mentioned. Content shift should be solveable by preloading the data, which you can instantly render. Thought these are small problems that can be looked separately after removing Svelte Query, as indeed, it is probably useful for larger use case scenarios

KTibow commented 5 months ago

Content shift should be solveable by preloading the data, which you can instantly render.

If you mean "load the data during build time", that causes it to go out of date quickly. If we try to fix this by updating it with client-side JS, we fetch the data twice and cause layout shifts if it renders differently.

oSumAtrIX commented 5 months ago

Preloading the data means, to load the data before displaying the site. In the example of the contributors page, the data of the contributors could be loaded before the page is accessed. The data is present instantly. This comes at the potential cost of making the request in vain, so instead you can block rendering before the data is loaded on page access. This will have the same effect as doing it on the server, as the server would have to prepare the data and thus block rendering. Thought, we are talking about very minor topics right now.

KTibow commented 5 months ago

Okay but where is it loaded? Are you talking about loading it client-side, eg on hover, or on the server?

oSumAtrIX commented 5 months ago

Since this is a static page, I mean on the client side, eg on hover. But content shift is a miniscule problem as it can be prevented easily as is with client side rendering. Removing Svelte Query is more of a refactor