Plotly i.c.m. Webview & cdn using togglebutton gets stuck

So we use a lot of webview (like 90% of the views are WebViews) and we make use of the Plotly figures using the cdn to avoid long reloadings.
image

This works perfectly fine if you change a number value. But if you use a togglebutton the view gets stuck on reloading. Nothing happens.

You can fix this by changing a numberfield for instance or another option.

The difficult thing is, it doens’t always result in this delay… but if it doesn, it just gets stuck forever.

Just for debugging: VIKTOR at 6:51 AM :wink:

Hi Johan,

Thank you for reporting. Could you share a minimal reproducible example? I tried with the following code both local and after publishing but I cannot reproduce. Am I missing something?

import viktor as vkt


class Parametrization(vkt.Parametrization):
    number = vkt.NumberField("Number")
    cdn = vkt.BooleanField("CDN")

class Controller(vkt.Controller):
    parametrization = Parametrization

    @vkt.WebView("Plotly")
    def get_view(self, params, **kwargs):
        import plotly.express as px
        fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])
        if params.cdn:
            data = fig.to_html(include_plotlyjs="cdn")
        else:
            data = fig.to_html()
        return vkt.WebResult(html=data)

Kind regards,

Raoul

In theory it should contain the same logic, however this view isn’t in isolation.
So sadly i do not have a snippet or something simular.

But as I saw it appear, I thought, better to report, so you if other people (or us) experience it again, it might be easier to reproduce / fix it.

Could you elaborate on what you mean by this? Does it happen across multiple views? Or only on a specific (web)view?

Regards,

Raoul