tjtanjin / react-chatbotify-gallery-website

Gallery website to browse, rate and share themes and plugins for React ChatBotify.
https://gallery.react-chatbotify.com
MIT License
2 stars 8 forks source link

[Feat] Reduce fetching of unnecessary theme files #38

Closed tjtanjin closed 2 months ago

tjtanjin commented 2 months ago

Is Your Feature Request Related to a Problem? Please describe. Currently, the themes page fetches the following files from GitHub/JsDelivr for each theme loaded:

That is 5 files per theme, and with the default 30 themes per batch, we're looking at up to 150 requests! 😱 Considering that we only need meta.json and display.png, the remaining 3 files are completely unnecessary.

In fact, those files are only required if a user is downloading themes (via the modal popup).

Describe Desired Solution The themes page should only fetch display.png and meta.json for each theme on load. Fetching of settings.json, styles.json and styles.css should be done on the fly when the user clicks the download button. This way we ensure that fetches for those files are only done when absolutely necessary 😊

Describe Alternatives Considered We can preemptively fetch themes when a user opens a theme modal in anticipation of a possible download request. But this is not desired because if we want to support bulk download in future, this could become a blocker.

HusseinSerag commented 2 months ago

This issue seemed to be resolved, is it already done?

tjtanjin commented 2 months ago

This issue seemed to be resolved, is it already done?

Nope, still open!

HusseinSerag commented 2 months ago

Can you please clarify more how is this problem occurring?

tjtanjin commented 2 months ago

Ahhh it's my oversight. It seems @NeonNature has taken that into consideration when implementing theme downloads 😊 Thank you for pointing it out!