Error disappears by updating any HTML element on the fusion gen page.

Source: https://perchance.org/fusion-ai-image-generator

Dynamic imports plugin: https://perchance.org/dynamic-import-plugin

I let name = localStorage.name , if it exists ,

when running dynamicImports(name).

I didn’t have this error when I implemented the localStorage thingy.

So I suspected this to be connected to some new added feature for dynamic Imports.

Ideas on solving this?

Code when I select names for dynamic import upon start (the error only occurs upon opening/reloading the page) :

_generator
    gen_danbooru
        fusion-t2i-danbooru-1
        fusion-t2i-danbooru-2
        fusion-t2i-danbooru-3

    gen_lyrics
        fusion-t2i-lyrics-1
        fusion-t2i-lyrics-2

...

_genKeys
    gen_danbooru
    gen_lyrics

...

// Initialize
getStartingValue(type) =>
  _genKeys.selectAll.forEach(function(_key) {
    document[_key] = 'fusion-t2i-empty';
    if (localStorage.getItem(_key) && localStorage.getItem(_key) != '' && localStorage.getItem(_key) != 'fusion-t2i-empty') {
      document[_key] = localStorage.getItem(_key);
    } else {
      document[_key] = [_generator[_key].selectOne];
      localStorage.setItem(_key, document[_key]);
    };
  });

...

  dynamicImport(document.gen_danbooru, 'preload');  

...

if (type == "danbooru"): return document.gen_danbooru; 
}; 

// End of getStartingValue(type)

...

_folders
  danbooru = dynamicImport(document.gen_danbooru || getStartingValue("danbooru")) 

  • @wthit56
    link
    English
    32 months ago

    You should use the dev tools in your browser to figure this out. In the sources tab of dev tools, turn on “break on caught error” and see if you can get to the line that looks like that one it printed out in that message. That’ll help you figure out what code is breaking.

    Presumably it’s in the dynamic importer plugin, so you could just look in that plugin’s code on the site, and see where that is, and find out what’s gone wrong that way.

    • @AdComfortable1514OP
      link
      English
      22 months ago

      Thanks! I appreciate the support. Helps a lot to know where to start looking ( ; v ;)b!

    • @AdComfortable1514OP
      link
      English
      12 months ago

      Do you know where I can find documemtation on the perchance API?

      Specifically createPerchanceTree ?

      I need to know which functions there are , and what inputs/outputs they take.

  • @perchanceM
    link
    English
    2
    edit-2
    2 months ago

    I’ve just updated the dynamic import plugin so it’s a bit more helpful with the error message. Looks like you’re passing undefined to dynamicImport.

    The error messages in Perchance are, in general, atrociously unhelpful. I really need to overhaul it so bugs like this are easier for you to find. From some fiddling with Chrome DevTools, it looks like the first instance of this type of error is occurring on this line:

    dynamicImport(document.i, 'preload');
    

    i.e. document.i is undefined when that runs.