[FIXED] Loading Animation ("Spinner") persists in plot loads in rendered PDF

I have a pretty complex system (for me…) that fetches data from an sql database, conditionally adds various forms to a base form, and then renders a .pdf. It’s become a central element of our business… on several of these forms I use plots to include bar graphs and such.

The data for these form-based plots is calculated in a background server task and eventually finds it’s way to the individual forms that house the plots. For many of our reports, we’re seeing the load animation (spinner) on the graphs. I’ve integrated all the anvil.server.call_s mods, and with clause that suppresses the spinner, however, I don’t think this is the cause. I think that when I load the data into the plot… at the form level, with size and other parameters… it’s taking a bit so… the spinner appears and then gets rendered into the .pdf.

Any ideas for how to suppress the animation on a plot object?

Does this help?

It’s possible I’ve missed something, here’s the order of events in my overall report production process:

[1] Front-end form - functions gather report parameters and call a server task
[2] Server-callable function - calls Server background task returns the task object
[3] Server background task:
(a) Communicates statuses back to the front-end form via background task states
(b) Calls multiple functions in the server module that are not callable (they’re faster that way)

And this is all within

with anvil.server.no_loading_indicator:


I used that (use that…) too… I think the issue is that PDF renderer uses a base form(A1Base) passing a dictionary (pdf matrix: “pdfmtx”) with a lot of data that will determine which report sections are included. A1Base conditionally includes or excludes report sections based on the data included in the pdfmtx dictionary, on some sections I’m passing data that is then used to create a plotly graph in a form’s plot object. While there’s nothing really crazy/complicated going on there, it’s only on top of the plots that we see the spinner… sometimes.

The fact that we only see the latent spinner on top of graphs created in this manner leads me to believe that it’s related to rendering these plots. It’s all happening within the PDFRenderer call… I suspect I’ve stretched the limits of combining all these features/functions

Do you think that anvil.server.no_loading_indicator could be used inside the form being rendered?

I haven’t rendered any PDFs Anvil’s way; I’m just trying to stimulate some ideas you might try, based on what I’ve read so far.

understood, and I appreciate the effort.

I’ve not considered using anvil.server.no_loading_indicator within a form, especially since the load of the plot object does not make a server call… I can try it though. One challenge is that the anomaly of a .pdf where the spinner is visible on superimposed on a plot object (graph) is intermittent… so it’s hard to test.

I’ve moved this to bug reports.
We’ll take a look and see if we can get that fixed.

Hi @dconnell - we’ve made a couple of changes to try to address this issue
Can you try again and see if it’s still happening?

Thanks – I’ll have my people keep an eye on things and report any anomalies soonest.

Hi Stu – What I see now is that all of my reports are generating the error below, and not running to completion:

Exception: PDF generation failed: Components did not load within allowed time.at /downlink-sources/downlink-2024-01-26-10-46-10/anvil/pdf.py, line 17called from /downlink-sources/downlink-2024-01-26-10-46-10/anvil/pdf.py, line 59called from PDFServerModule_V3, line 1282


Dane Connell

Mobile: 304.270.6169, cybeta.com


Thanks - we’ll take a look
(edit: that should be fixed)

Not sure if anything changed on your end, this morning I’m able to run my reports.


Dane Connell

Mobile: 304.270.6169, cybeta.com


1 Like