#FQL Error (Collapse Sidebar Early Fire on Foundry Startup)
1 messages · Page 1 of 1 (latest)
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?
I'd venture the sidebar collapse is occurring because of Minimal UI module functionality. I'll disable it to see if it affects the error.
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.
Under Minimal UI settings I toggled Right Side Panel Behavior from "Start Collapsed" to "Start Visible" and the error did not occur.
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.
@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
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
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.
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
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...
@thorny current could you please confirm you are on Minimal UI 1.0.9 and Foundry 0.8.9?
Good to know. I had Minimal UI v1.0.6 and just upgraded to 1.0.9, but no problems with either.
I’m on the latest version of Foundry. All mods updated before reporting this issue today.
Foundry 0.8.x made afaik many of the hook initializations async, it makes sense to observe timing issues.
Sorry my ignorance, what is FQL ?
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.
oh wow, FQL is reported compatible with Foundry 0.7.7 - is it being maintained at all?
okay, thanks. checking
FQL version is 0.7.7 - Foundry v0.8.6-v0.8.9 compatibility set.
in the error, libWrapper is mentioned. None of these modules use libWrapper,
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).
yes, and by now we probably already frustrated spaceflows 😄
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
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? 😜
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
Yeah, I went a little bonkers at first, hit about 80, and am now slowly removing many.
Yes, I admit Foundry is very inviting on installing modules haha
easy to do, awesome and creative stuff
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
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.
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
Yeah. The chat is becoming the Wild West!
I do love Minimal UI. I may dump something else to maintain its reliability.
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
Sounds like libwrapper should be a requirement for approval of those types of mods?
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.
Interesting. Frustrating for us laymen, but fascinating nonetheless. Well, from now on, I’ll definitely be opening Foundry with the console open too.
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.
I still think trying just FQL the add just Minimal UI is a reasonable test.
I suspect it’s the Playlist mod I added that’s conflicting.
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
these ones at least dont show any problems for me, also none of them uses libWrapper.
Yeah.. Just unclick all except FQL.. Confirm no problem. Then add Minimal UI and check.
right, enabling modules one by one or in group until you find the problem is a good idea.
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
;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.
this is all there is to the right sidebar 😛 https://github.com/saif-ellafi/foundryvtt-minimal-ui/blob/main/modules/component/sidebar.js
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
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. 😄
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.
checking
dang I have all of these enabled and nothing
what is FoundryUIManager ? nvm
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.
did you change any settings on FQL?
None. Haven't touched it.
damn, super strange. I cant reproduce this. So it happens as soon as you open foundry
Yes. As soon as I add FQL.
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?
at this time, what was it?
Yes, when I began enabling other mods, the error appeared immediately.
The only way to remove it and keep FQL is to toggle
If it's set to "Start Collapsed", error.
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
Yes. It's strange. The first mod added after FQL and Minimal UI, no matter what mod it seems, causes the error.
@robust sandal - ever heard of FoundryUIManager.js ??
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.
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.
Um... That may be a bit above my pay grade. I'm not sure how to do that. How do I manually edit a module?
I just need to make a new release.
where what why 😄
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.
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.
Both of these files are located the data directory /modules/forien-quest-log/src/control/
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.
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. 😄
I see! I see! Ah, okay. Lemme see now... Stand by...
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.
here one way on Windows to find the data folder
normally in C:\Users\your_name\AppData\Local\FoundryVTT
Oh yeah the under the "Data" directory, but I think you found it already.
I found it. Just making sure. I'm cutting the line from one and adding to the other?
Yeah.. Line 56 from FQLHooks.js to line 18 in FoundryUIManager.js the picts show the exact line.
nono, the line 18, that starts with Hooks.on ... remove it from there
Hooks.on('collapseSidebar', FoundryUIManager.collapseSidebar); is replacing Hooks.on('renderSceneNavigation', FoundryUIManager.updateTrackerPinned);
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
It is done. Here we go... 🙏
remember to save 😄
Yeah.. cross fingers... Here in this pict I show 25 modules enabled including Playlist UI / Playlist Down along with Minimal UI and no problems. 😮
Hmm...
What was that other action you asked me to do to give you a fuller picture of the console report?
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
did you restart foundry or restart the world after the change?
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.
Notepad++ is great on Windows
I'm on mac. Got VSCode
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. 😮
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
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. 😮
I boot my windows laptop to test this xD so windows is all good
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.
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?
Um....
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??
Yes.
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.
Yes. I was at one time, then moved to Forge to host.
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
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... 😮
super mega cool
Weird...
does the hook rearrangement help?
So, I'm not crazy?
at least not yet 😄
But I bet, OS specific bugs are of the rarest type (in Foundry modules)
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.
JS isn't multi-threaded.
ok should go read about that and how it does async then 😄
Chrome Version 93.0.4577.63
so that is the latest version available :/
Mine just updated to Version 93.0.4577.82
Right likewise had to restart, but that is the latest
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.
But you’re getting it on Mac/Chrome?
Only rarely at this point seemingly and yes only on Mac/Chrome so far.
Do you see it constantly on every reload?
No, actually. It comes and goes.
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. 😮
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.
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
Very cool! I’ll definitely visit. My campaigns have always been designed as open-world.