I am working on a panel app and I have noticed a strange behavior with some of my custom components.
- First I start my app (it’s all .py files; my main app object is .servable() and I run it using panel serve with -dev from command line). It loads fine visually, but when I click on the input widgets (e.g. buttons) inside my custom component they don’t do anything. If I hit F5 in the browser, it reloads but still widgets are unresponsive.
- I make a change to one of the source files and hit save. Since I’m running with -dev the app autoreloads. It doesn’t have to be a code change, even just removing or adding a comment or some white space can work–as long as it triggers autoreload.
- If I go back to the browser with the reload app, now input widgets work. They continue to work with subsequent code changes and autoreloads–it’s only broken when I restart the app completely, and only until the first autoreload.
My custom components extend from the Viewer class. Each one is in its own .py file. (Side note: I’m calling pn.extension() in every file; I’m not sure if this is necessary or if I should only do it in the main app file instead. Regardless, it doesn’t appear to affect this bug.)
One of my custom components is a control with multiple buttons which goes into the sidebar. (My app is built using the Material template, so it comes with a sidebar as part of its layout.) Sometimes the buttons in this one work on the first load.
Another is a Modal with a File Selector and a submit Button inside. The list of files in the folder appear, but the buttons in it don’t do anything when clicked. Nothing happens when you click the submit Button either. This one seems to never work on the first load.
Has anyone else experienced this before? I don’t see any errors in the logs so I’m not sure where to start debugging it.