Update state when component is displayed in the front end
I am using solara for an experimental logbook app. The app displays a list of markdown entries, and this list can get quite big and slow to load, expecially if there are images inside.
With some simple print debugging, i can see that my custom components render quite fast, but the solara.Markdown() takes a while to rended when there are large images to display.
I am thinking of only displaying the text (without images) at first, and only when that is done, go back and add the images. But i would need some kind of callback that updates a reactive variable when a component has finshied loading on the client. Is this possible? Is there a better way to improve performance?
2 Replies
Do you have an example of that? I wouldn't know why it would be slow with the images. Do you have a PyCafe example that demonstrates the problem?
I would try to serve the iimages from static directory. https://solara.dev/documentation/advanced/reference/static-files
Using static files and resources in your Solara application
When using Solara, you can host static files, like images, which will then be available at /static/public, in the ../public folder.