Genie Discord forum

Author Avataritsdfish
4/3/2023, 10:42:05 PM

Hi all,

Autoreload works great when updating my code, except if I make a change that results in an error. When that happens, autoreload uses a previous version of my code. It does not recognize corrections/changes made thereafter. This is really frustrating because I need to restart Julia in order fix autoreload.

Is there a way around this or a place where I can file an issue?

Author AvatarPere
4/4/2023, 8:09:01 AM

Can you share the output in the REPL when you encounter this? Sometimes this happen because Revise.jl (the package that reloads file changes) is unable to apply the changes. In that case, Revise will show a debug message

Author AvatarPere
4/4/2023, 12:53:28 PM

@itsdfish for some reason I assumed you were using Genie Builder. If you are working with just a Julia REPL and want want changes to automatically reload, use Revise and includet instead of include:

using Revise includet("app.jl")

Author Avataritsdfish
4/4/2023, 4:35:51 PM

@Pere, thanks for your reply. I have experienced the issue with the Builder and at the REPL. For some reason, I am unable to get your solution to work. It doesn't recognize any changes, even after refreshing the page.

For some reason, I cannot reproduce the problem. I feel like Genie is gaslighting me 😆 , but I suppose it could be user error. I will report back if I can reproduce the problem. It might be that certain only types of errors lead to the problem.

Author Avataritsdfish
4/4/2023, 5:00:27 PM

Ok. Here is the problem: I cannot consistently produce the same results. Sometimes it works, sometimes nothing updates, other times it works until I introduce a bug... still other times, the page completely crashes and becomes unresponsive to changes in the code. Each time I try with a fresh Jullia session.

Author Avataritsdfish
4/4/2023, 5:01:48 PM

I attached the error message from the catastrophic error.

Author Avataritsdfish
4/4/2023, 5:03:02 PM

I guess the way to reproduce the behavior is to break the code with bugs (such as removing commas) and fixing the bugs until it stops working as expected.

Author Avataritsdfish
4/4/2023, 5:03:14 PM

Here is the code I was using

app.jl

  using GenieFramework
  using Distributions

  @genietools 
    @handlers begin
      @in mu = 0.0
      @in sigma = 1.0
      @out pdf_plot = PlotData()
      @out layout = PlotLayout(
                      xaxis = [PlotLayoutAxis(xy= "x", title = "x")],
                      yaxis = [PlotLayoutAxis(xy = "y", title = "density")])

      @onchange isready, mu, sigma begin 
        println("hi")
        dist = Normal(mu, sigma)
        q1,q99 = quantile(dist, [.001, .999])
        x = [range(-5, q1, length=5)..., 
            range(q1, q99, length=100)..., 
            range(q99, 5, length=5)...]
        y = pdf.(dist, x)
        pdf_plot = PlotData(; x, y, mode="lines")
      end
    end

  @page("/", "app.jl.html")
  Server.isrunning() || Server.up()

app.jl.html

<h1>Default content</h1>
<div class="row">
    <div class="col col-6 col-sm">
        <p> mu {{mu}}</p>
        <q-slider :min="-5" :step="-.1" v-model="mu" :max="5"></q-slider>
    </div>
    <div class="col col-6 col-sm">
        <p> sigma {{sigma}}</p>
        <q-slider :min="0" :max="5" :step=".1" v-model="sigma"></q-slider>
    </div>
</div>
<div class="row">
    <div class="col col-12 col-sm">
        <p>awesome plot<br /></p>
        <plotly :data="pdf_plot" :layout="layout"></plotly>
    </div>
</div>
Author Avataritsdfish
4/4/2023, 5:03:54 PM

Sorry I cannot provide a reproducible result, but that seems to be the nature of the problem.

Author Avatarabhimanyuaryan
4/7/2023, 6:59:32 AM

Is this when you update julia code or .jl.html code that reload/revise stops working?