#FQL Error (Collapse Sidebar Early Fire on Foundry Startup)

1 messages · Page 1 of 1 (latest)

robust sandal
#

Hi @thorny current. That error is a bit strange as it looks like it is the result of some interaction with the Foundry sidebar collapsing in the startup / initialization of Foundry which occurs before FQL is initialized. The stack trace w/ JQuery involved means there is some sort of interaction occurring.

I'd first ask if there is anything you are manually doing interacting with the sidebar, but this is probably not the case. Since I see that you have lib-wrapper enabled what other modules do you have enabled and are there any other modules which happen to manipulate the Foundry sidebar state on startup? By default Foundry doesn't collapse the sidebar on startup, so my guess is some other module causing this collapse to occur, but that can't be determined from the stack trace that you have provided.

What other modules do you have enabled?

#

Does this error occur when you only have FQL enabled?

thorny current
robust sandal
#

That is the likely culprit..

#

I'll check it too.

#

I actually test against minimal UI and I can't get it to cause the same error in the Electron app or in Chrome browser with an existing world or a fresh world with minimal UI activated before FQL.

thorny current
#

Under Minimal UI settings I toggled Right Side Panel Behavior from "Start Collapsed" to "Start Visible" and the error did not occur.

robust sandal
#

Well we have indeed narrowed things down to a side effect from another module.

I can't reproduce it on my side regardless of how I set minimal UI in the two worlds I have tried.

There is a possibility that order of execution varies between when module hooks are executed. There also is a possibility in subtle timing issues as the FQL "Foundry ready hook" is async so that could lead to minimal UI running the collapse before FQL finishes the ready hook. However I still can't duplicate this behavior on my side.

For a complete test case you can manually edit any module to add CONFIG.debug.hooks = true; which will post additional data when hooks are called in the console. I suggest temporarily putting it in `/modules/forien-quest-log/src/init.js on like the pict.

Then capture the tail end of all the console log statements and paste it in here so I can take a look.

#

For instance here is what the console log looks like with hooks w/ minimal UI collapsed on my side:

Foundry VTT | Retrieved and compiled template modules/forien-quest-log/templates/quest-tracker.html
foundry.js:173 DEBUG | Calling renderQuestTracker hook with args:
foundry.js:174 (3) [QuestTracker, S.fn.init(1), {…}]
foundry.js:173 DEBUG | Calling renderApplication hook with args:
foundry.js:174 (3) [QuestTracker, S.fn.init(1), {…}]
foundry.js:147 DEBUG | Calling updateMacro hook with args:
foundry.js:148 (4) [Macro, {…}, {…}, 'GxE5bXqMZAfGeEQa']
foundry.js:173 DEBUG | Calling renderHotbar hook with args:
foundry.js:174 (3) [Hotbar, S.fn.init(1), {…}]
foundry.js:173 DEBUG | Calling renderApplication hook with args:
foundry.js:174 (3) [Hotbar, S.fn.init(1), {…}]
foundry.js:147 DEBUG | Calling ForienQuestLog.Lifecycle.ready hook with args:
foundry.js:148 []
foundry.js:147 DEBUG | Calling collapseSidebar hook with args:
foundry.js:148 (2) [Sidebar, true]

And you can see that the QuestTracker is rendered before the final collapseSidebar hook call which doesn't cause the error that you are seeing for whatever reason.

finite flame
#

@robust sandal @thorny current Hello! I have seen Minimal UI mentioned around here 🙂 I am not having much development time lately, but if you find any possible issue on the module please drop an issue on the GitHub - Maybe I can give a hand and others can benefit from it too. https://github.com/saif-ellafi/foundryvtt-minimal-ui/issues

GitHub

Foundry VTT Module. Configurable UI module, allows the user to hide, collapse or auto-hide components separately. - Issues · saif-ellafi/foundryvtt-minimal-ui

#

Latest versions of Foundry changed things in regards of load orders and hook orderings. As some work arounds it is more normal that modules, including Minimal UI, wait a few milliseconds in order to ensure smooth transitions and compatibility. It can be tricky to figure out race conditions between modules.

#

Best is always to ask ourselves questions like:

  • Likely conflicting modules. If the right sidebar is an issue, modules that make changes to chat, or add events, or change content in the history
  • Check if the behavior is random or sporadic
  • Check if it still happens with no modules installed, before looking for specific module conflicts
robust sandal
#

Yeah.. This isn't an issue I can reproduce on my side and I actually tested w/ Minimal UI before launching the most recent FQL version which introduced this new functionality interacting w/ the sidebar.

It does appear to be a hook order issue possibly, but still a bit strange as FQL doesn't register for the collapseSidebar hook until after the UI has been initialized.

I can of course add in a check to make sure the reference to the UI Application in question is valid before calling .rendered() on it, but indeed a somewhat strange timing issue and one that isn't immediately replicated with just Minimal UI / FQL on my side, @thorny current indicated that things were fixed on his side when the minimal UI sidebar setting is set to visible / non-collapsed.

finite flame
#

I wouldn't then discard that spaceflows is on an outdated version of Minimal UI. I have been making some changes in the latest small releases, particularly in the last two releases.
https://github.com/saif-ellafi/foundryvtt-minimal-ui/issues/46
https://github.com/saif-ellafi/foundryvtt-minimal-ui/issues/50

GitHub

This is a strange bug to report because its so inconsistent. Using Find the culprit I could never find a single module that would be the cause this behavior. Effectively with anything in the chat l...

GitHub

When Scene Navigation Style is set to Start Collapsed, it actually starts visible. Not only that, it takes two clicks to make it collapsed. The first click does nothing.

#

@thorny current could you please confirm you are on Minimal UI 1.0.9 and Foundry 0.8.9?

robust sandal
#

Good to know. I had Minimal UI v1.0.6 and just upgraded to 1.0.9, but no problems with either.

thorny current
finite flame
#

Sorry my ignorance, what is FQL ?

robust sandal
#

I don't believe Foundry Hooks scenario supports async hooks. Forien's Quest Log.

#

I do however have the "ready" hook callback async on my side which could conceivably cause timing issues, but as mentioned it's strange as I don't register for the collapseSidebar hook until after the UI has been initialized and rendered on my side in the same "ready" hook.

#

@finite flame if you are installing FQL to also take a look this involves the quest tracker. You have to open the main quest log. add a quest, make it active, then show the quest tracker then restart Foundry.

finite flame
#

oh wow, FQL is reported compatible with Foundry 0.7.7 - is it being maintained at all?

#

okay, thanks. checking

robust sandal
#

FQL version is 0.7.7 - Foundry v0.8.6-v0.8.9 compatibility set.

finite flame
#

in the error, libWrapper is mentioned. None of these modules use libWrapper,

robust sandal
#

Yeah.. I brought that up that there are more modules enabled previously.

#

Though this is specifically caused by the collapseSidebar hook response. When @thorny current gets a chance just try FQL and Minimal UI. Start w/ FQL then enable Minimal UI.

#

There is an off chance of course somehow it's another module modifying something about the sidebar on startup. As mentioned I don't see any issues with just FQL / Minimal UI on my side testing in Electron and Chrome (technically both Chrome).

finite flame
#

yes, and by now we probably already frustrated spaceflows 😄

robust sandal
#

Heh heh... ;P

#
01000001 01101100 01110111 01100001 01111001 01110011 00100000 01001100 01101111 01101111 01101011 00100000 01001111 01101110 00100000 01010100 01101000 01100101 00100000 01000010 01110010 01101001 01100111 01101000 01110100 00100000 01010011 01101001 01100100 01100101 00100000 01101111 01100110 00100000 01001100 01101001 01100110 01100101
thorny current
#

Haha. Nah… 😐

#

I have another mod that may be working against it. One that rearranges the Playlist page. I’ll try disabling and testing again. Does anyone ever wonder if there may be just a wee bit too many mods out there? 😜

finite flame
#

Ive seen crazy people installing hundreds of mods before playing for the first time 😄

#

Also people with +300 modules and everything somehow functioning

#

So there is no rule. The best practice is to start small and add modules on a need basis

thorny current
#

Yeah, I went a little bonkers at first, hit about 80, and am now slowly removing many.

finite flame
#

Yes, I admit Foundry is very inviting on installing modules haha

#

easy to do, awesome and creative stuff

thorny current
#

I mean, I am trying to play D&D after all 😂

#

GMing is complicated enough!

finite flame
#

exactly haha. Also keep it simple for yourself

#

Prep time is already consuming xD

#

I found myself at a times spending hours preparing Music playlists and amazing macros

#

then my players were ignoring the music and in no way interested on macros xD

#

they wanted to point click and roll dice

thorny current
#

Exactly the same here. That’s why I’m dialing back the mods. While I think they’re incredible, I just don’t have the bandwidth to constantly troubleshoot.

finite flame
#

Yes, sorry to hear Minimal UI is causing conflicts

#

it should technically not. But at first it sounded simple to just collapse the sidebar on startup xD

#

Suddenly lot of other mods do stuff on the chat or the startup itself, and contradict collapsing the sidebar

thorny current
#

Yeah. The chat is becoming the Wild West!

#

I do love Minimal UI. I may dump something else to maintain its reliability.

finite flame
#

libWrapper for starters is a module created exactly for that, hence the problem you got. It is a module that helps organize modules that "know" they will conflict. but it relies on developers using it. In your case it sounds like Foriens Quest Log and another module that uses libWrapper, is complaining about a rendered call. Who knows

thorny current
#

Sounds like libwrapper should be a requirement for approval of those types of mods?

finite flame
#

When a module developer uses libWrapper, then it is a requirement for that module. But when a module developer touches a "potentially conflicting" area of Foundry, without libWrapper, then the modules will just fight each other for control of such conflict, and it depends on their load order, and whichever starts or runs first, leading to unpredictable outcomes.

#

When two modules that touch a conflicting area, use libWrapper, then libWrapper helps making sure both can coexist. It can also detect when they simply cant coexist and inform the user. In other cases, one module uses libWrapper but the other does not, then you get errors, Likely what you are perceiving here.

#

Minimal UI not collapsing is then likely a side effect, of other modules breaking the startup process.

#

But as Typhon suggested, nothing between FQL and Minimal UI is conflicting.

thorny current
#

Interesting. Frustrating for us laymen, but fascinating nonetheless. Well, from now on, I’ll definitely be opening Foundry with the console open too.

finite flame
#

haha yes. Just as you said, the more Modules you add, the more alert you should be. It is also important to foresee problems that your players may suffer and frustrate about.

robust sandal
#

I still think trying just FQL the add just Minimal UI is a reasonable test.

thorny current
#

I suspect it’s the Playlist mod I added that’s conflicting.

robust sandal
#

But just undo all and do a quick test.. ;P This specifically deals with the sidebar collapsing on startup. I don't think the playlist mod probably touches that; at least I'd guess that.. ;P

finite flame
#

these ones at least dont show any problems for me, also none of them uses libWrapper.

robust sandal
#

Yeah.. Just unclick all except FQL.. Confirm no problem. Then add Minimal UI and check.

finite flame
#

right, enabling modules one by one or in group until you find the problem is a good idea.

robust sandal
#

Also if you do find yourself with a lot of modules installed and a problem occurs in the future there is a testing module called "Find the Culprit" which helps do a "divide and conquer" / binary search of disabling half the modules then asking if you see the problem. Then it enables the other half and continues onward in smaller groups of modules enabled.

#

Alas a lot of creativity out there, but also a lot of folks new to programming and a wide range of skill w/ not as many made by rock solid developers. I make it a point to avoid modules that need to monkey patch whether using libwrapper or not. 😮

Also can see the coding quality as most modules are open source and um... Quality could be better overall.. ;P

finite flame
#

yeah better not look into minimal ui source code 😄

#

I am no front end developer

robust sandal
#

;P Present company accepted.. ;P But yeah.. If we can pinpoint the issue here I'd be glad. There are things to potentially better protect on my side, but this should already be in place, so curious how things are not working / where the conflict is coming from.

finite flame
#

anyways, going for a break. THanks all for the feedback and chat. Anything found, feel free to report an issue on the github and I can try to give a hand

robust sandal
#

Well at this point enable the modules 1 by 1. Probably "Playlist Down" / "Playlist UI" would be my guesses by the module names. Right now it would be great to file an issue with the given module. Or once you find it I'll install it and create a detailed report. 😄

thorny current
#

Wow... Just added the first Mod and ... BAM! Got this error:

#

The mod added is Autocomplete Whisper

#

Oy! Now getting this with only Minimal UI, FQL, and Better Roofs.

finite flame
#

checking

#

dang I have all of these enabled and nothing

#

what is FoundryUIManager ? nvm

thorny current
#

The only mods I have enabled are FQL, Minimal UI, and lib-color. And I'm getting this:

#

I'm on Chrome.

#

No VPNs or Firewalls.

#

If I turn off FQL, no errors.

finite flame
#

did you change any settings on FQL?

thorny current
#

None. Haven't touched it.

finite flame
#

damn, super strange. I cant reproduce this. So it happens as soon as you open foundry

thorny current
#

Yes. As soon as I add FQL.

finite flame
#

but earlier you said FQL and Minimal UI did not give any errors

#

it is only when you went through enabling other mods, that then this started happening?

finite flame
thorny current
#

Yes, when I began enabling other mods, the error appeared immediately.

finite flame
#

but then you disabled all of them again, and it still happens?

#

super strange

thorny current
#

The only way to remove it and keep FQL is to toggle

#

If it's set to "Start Collapsed", error.

finite flame
#

Yes, that for sure it is clear. Foundry is failing to hide the sidebar on the error you showed above

#

what I dont understand is why at some point it worked, and then you added other modules, disabled them, and then it fails

thorny current
#

Yes. It's strange. The first mod added after FQL and Minimal UI, no matter what mod it seems, causes the error.

finite flame
#

@robust sandal - ever heard of FoundryUIManager.js ??

robust sandal
#

If you go back to the beginning of the thread I clear describe what is going on... Also @thorny current any chance you add the CONFIG.debug.hooks = true; statement as mentioned and copy / paste the complete tail end of the console and not just the error.

#887411526946930749 message

finite flame
#

Sorry, I may be tired

#

I just don't recall any javascript resource under that name

robust sandal
#

No worries.. You jumped in mid-stream. 😄 FoundryUIManager is new code added in 0.7.7 and responds to collapsedSidebar hook.

Ah dang... I suppose there could be an issue.. due to odd ordering of module hooks.

#

Easy fix and not something you'd see unless potentially many modules involved. Still curious about the side effect which causes it, but I can better protect against the issue knowing it exists.

thorny current
robust sandal
#

I just need to make a new release.

finite flame
#

where what why 😄

robust sandal
#

I register for 'collapsedSidebar' before the UI is initialized. Can move that from FQLHooks.init line 56.

#

to FoundryUIManager init line 18:

#

Any chance @thorny current that you can try this change. It is a simple text edit removing that line from FQLHooks and putting it in FoundryUIManager at the same place in the images and restart Foundry.

#

Not even restart Foundry just load the world again. Error should go away regardless of modules enabled.

finite flame
#

Ha. I just realized you are FQR maintanier 😄 this is modules code. Thanks and sorry for confusing people. @thorny current to change that you have to go to the modules folder on Foundry.

robust sandal
#

Both of these files are located the data directory /modules/forien-quest-log/src/control/

thorny current
#

Ah! I'm looking in the console under Sources and have NO CLUE what I'm doing. I'll look where you're directing me.

robust sandal
#

Yeah.. The file system using Windows explorer if on Windows and going to where you have the Foundry data directory. Indeed a little bit of an ask, but it would be nice to know this solves the problem before I push out a release when I can't duplicate the problem here yet.

#

Open both files with a text editor and swap the lines. 😄

thorny current
#

I see! I see! Ah, okay. Lemme see now... Stand by...

robust sandal
#

Cool. I just enabled 30 modules and this issue doesn't pop up! So your combination of modules is somehow causing a side effect, so it is helpful to know that change fixes the issue.

finite flame
#

here one way on Windows to find the data folder

#

normally in C:\Users\your_name\AppData\Local\FoundryVTT

robust sandal
#

Oh yeah the under the "Data" directory, but I think you found it already.

thorny current
#

I found it. Just making sure. I'm cutting the line from one and adding to the other?

robust sandal
#

Yeah.. Line 56 from FQLHooks.js to line 18 in FoundryUIManager.js the picts show the exact line.

thorny current
#

K. Replacing what's on line 18 with line 56?

#

Sorry. I know I'm a slowpoke.

finite flame
#

nono, the line 18, that starts with Hooks.on ... remove it from there

thorny current
#

Hooks.on('collapseSidebar', FoundryUIManager.collapseSidebar); is replacing Hooks.on('renderSceneNavigation', FoundryUIManager.updateTrackerPinned);

finite flame
#

and put it below the line window.addEventListener...

#

no replacements, just move it from one place to another

#

without replacing any other lines

#

something like this

This line here

other lines
other lines

to

other lines

This line here
other lines
#

just make sure that it is exactly below the one that Michael pointed out

#

in the picture

thorny current
#

It is done. Here we go... 🙏

finite flame
#

remember to save 😄

robust sandal
#

Yeah.. cross fingers... Here in this pict I show 25 modules enabled including Playlist UI / Playlist Down along with Minimal UI and no problems. 😮

thorny current
#

Hmm...

#

What was that other action you asked me to do to give you a fuller picture of the console report?

finite flame
#

you can drag & drop the file you changed here on Discord so Michael can check it for you

#

or viceversa, Michael could give you the files and you put them there

thorny current
#

The two I changed according to your instructions 🤞

finite flame
#

did you restart foundry or restart the world after the change?

thorny current
#

I restarted Foundry.

#

Restarted world:

#

Okay. I've downloaded a Code Editing Text editor, in case you'd like me to do more, or try it again if I messed it up using text editor.

finite flame
#

Notepad++ is great on Windows

thorny current
#

I'm on mac. Got VSCode

robust sandal
#

Simple text editor should work. Here is the rub. I installed all the modules you previously posted. Enabled all of them and things work without the modification I mentioned. 😮

finite flame
#

haha me too. I tried abunch

#

what baffles me of the current error trace is that simply the variable tracker is undefined

#

so 3am here I already forgot everything about the hooks and stuff hahaha

robust sandal
#

I should note Autocomplete Whisper and Playlist UI are only compatible with 0.7.9. But even with those enabled I don't see the issue..

Heh.. I have a Mac... Going to go start things up there to test. 😮

finite flame
#

I boot my windows laptop to test this xD so windows is all good

thorny current
#

Okay... Like... I don't know. No errors now.

#

Lemme add a mod and see what happens.

#

I really don't get it. I restarted Foundry a few times and suddenly... no error, after returning the error every time before.

finite flame
#

yes there is something sneaky about this

#

either one of the modules you enable screw up something bad, for that session

#

and after you restarted foundry is all good again

#

this got fixed after you restarted it right?

#

or.. Michaels fix did something

#

could you revert the change of the lines?

thorny current
#

Um....

robust sandal
#

You did make the text change though in the FQL source? That could still potentially fix it.

Yeah I was going to ask.. Looks like you are using The Forge??

thorny current
#

Yes.

robust sandal
#

Ah yes.. You can't modify the module source then as you are not running things locally.

#

Though it did sound like you were running Foundry locally if you found the files.

thorny current
#

Yes. I was at one time, then moved to Forge to host.

finite flame
#

Then it is very likely that the fix you propose should help, even if non reproduceable

#

Your hook goes first, MinimalUI triggers a collapse after 100ms

#

and it calls your hook before apparently FQL got initialized

robust sandal
#

The hook is for the collapse.. Granted moving where I register that particular hook may help for this still unknown side effect.

#

So interestingly enough I can duplicate on Mac / Chrome... 😮

finite flame
#

super mega cool

robust sandal
#

Weird...

finite flame
#

does the hook rearrangement help?

thorny current
#

So, I'm not crazy?

finite flame
#

at least not yet 😄

#

But I bet, OS specific bugs are of the rarest type (in Foundry modules)

robust sandal
#

Even Chrome versions.. Heh.. I just updated Chrome on the Mac.. And now the issue is gone even when I enable 25 modules including the same ones you have installed. 😮

#

Perhaps try updating Chrome, but before you do see what version you are on right now.

finite flame
#

wow. Any chance for just being random? just a race condition of threads?

#

lol

robust sandal
#

JS isn't multi-threaded.

finite flame
#

ok should go read about that and how it does async then 😄

thorny current
finite flame
#

so that is the latest version available :/

robust sandal
#

OK I see it again on latest chrome.. ;P

#

Yeah.. That is the latest.

thorny current
#

Mine just updated to Version 93.0.4577.82

robust sandal
#

Right likewise had to restart, but that is the latest

robust sandal
#

Yeah it's annoying. I can't get it to appear for any rhyme or reason. With 30 modules active or 2. It would be nice if there was a repeatable situation. Pretty sure the fix I mentioned solves the result of this out of order hook calling, but still a weird issue.

thorny current
#

But you’re getting it on Mac/Chrome?

robust sandal
#

Only rarely at this point seemingly and yes only on Mac/Chrome so far.

#

Do you see it constantly on every reload?

thorny current
#

No, actually. It comes and goes.

robust sandal
#

Well.. Going to hit reload 100 or so more times w/ the fix. The good news is that this issue isn't fatal seemingly. Just posts an error to the console. I probably won't push this out right away, but it will go into the 0.7.8 release which is several weeks out. That is of course unless a bunch of other people report it.

#

@finite flame it does appear that when it does occur rendering of the sidebar occurs much earlier than other occasions. Not sure what triggers your delay to call collapse, but this isn't a fatal issue. Should be protected w/ my change.

#

Weird stuff like the MacBook Pro I have not being very capable and chugging hard to load Foundry might also affect the 100ms delay and timing of when it is triggered vs my fast PC / Windows box. 😮

thorny current
#

Thanks for the deep dive. The error is certainly not a game breaker, as you said, but I’m glad it will lead to you honing a great mod that much more.

robust sandal
# thorny current Thanks for the deep dive. The error is certainly not a game breaker, as you said...

Absolutely.. Right now this "extreme" hard to test edge case is the only thing that popped up after the latest release. FQL is rather rock solid right now. If you are interested I run a separate Discord server where FQL chat happens and discussion / brainstorming about new features occurs. I'd be glad to chat more there. I also have big plans for a larger suite of modules for aiding open world style of running campaigns. https://discord.gg/mnbgN8f

thorny current