For me , whenever I load datasets into the Fusion Generator I have to be mindful on how many items I load into the generator upon start.

If I load too much data , or do something crazy with the HTML , then there is a risk some users ( like those who browse perchance on older phones ) will not be able to access the generator page at all.

They will get a browser error message, and will not be able to access the generator at all to report the problem. They will be locked out forever , effectively.

So my suggestion is to have some kind of default “Oops something went wrong” page when loading generators on a perchance page.

The generator owner can customize the text written on the page. Maybe the image as well.

Importantly , they should be able to direct the user to somewhere (like a discord page) where they can report the problem.

TLDR : If the generator fails to load , show a link to a “Bug Report” page

  • VioneT@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    You can probably do something like this;

    <script>
      let checkForCurrentErrors = setInterval(() => {
       if(__currentPerchanceErrorCount > 0) {
         clearInterval(checkForCurrentErrors)
         errorPage.style.display = 'block';
       }
      }, 10)
    </script>
    <div id="errorPage" style="position: absolute; z-index: 999; display: none; width: 100dvw; height: 100dvh; background: blue;">
      Testing Error Page <br>
      Please Reload the Page
    </div>
    

    It is an interval that checks if there was a perchance error happened. You could also probably have a timeout in which if the page doesn’t load for more than 30 seconds, then it would show the error page.

    However, these solutions only happen when the page has already been working, meaning, if they just opened up the page, it would still take the Perchance server to send the data first before it loads (where the loading issues might happen), in which case, it needs a server-side code to fire to report that the generator isn’t loading.

    Depending on the error you want to handle, there might be solutions that we can code and not need the server to provide it for us.

    • perchance@lemmy.worldM
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      Heads up that __currentPerchanceErrorCount, and all other global variables that begin with __ are “private” (engine-internal) variables, meaning that I may change their name at any time, causing generators to break that were using them. As I mentioned to Bluepower, if you find a variable in the console, you should first check if it’s officially documented (likely on perchance.org/advanced-tutorial ) before using it, and if it’s not, then it should be assumed to be private.