DevTools attach to main monarch app instead of a story
I can't seem to debug any stories in DevTools. Not sure yet if this is a bug or just me missing something though...
Whenever I press the "Launch DevTools..." button, it seems to attach to the main Monarch app instead of the story and I can only debug that but not stories.
I have monarch v3.7.0 flutter package and v2.2.2 binary installed on a Mac.
Minimal repro:
-
monarch run - select "primary" from the sample_button_stories
- press Launch DevTools...
In DevTools, Flutter Inspector
- the console says the active story id was set properly to sample_button_stories.dart
- but the Widget Tree that was loaded is the MonarchControllerApp's in and Switching to the Debugger tab
- the monarch_controller_main.dart file is loaded and
- can't open the story's file (cmd + P and then searching for "sample_button")
See the screenshots of these below.
I've tried restarting/reloading the stories and DevTools, didn't seem to help.
Any pointers what could be wrong?
Can you quit Monarch ⌃C on your terminal and then run it again? I remember seeing this issue in older Flutter versions. However, this issue was not consistent. You may need to try a couple of times until DevTools attaches to your stories.
I just tried it on Flutter 3.13.6 on macOS without issues. Attaching and debugging stories worked as expected.
Thanks for the quick response!
Looks like the Flutter version does matter indeed.
v3.13.6 -> works fine v3.13.7 -> issue - was on this originally, quitting/restarting monarch didn't help v3.13.9 -> same issue
Will try and test/dig a bit more...
I had documented this issue and its workaround on the code:
https://github.com/Dropsource/monarch/blob/c36e271a93ba484171146c08a54449e85665b266/platform/macos/monarch_macos/WindowManager.swift#L121-L130
The workaround had been working but I think it is time to look into a proper fix.