Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateRange is not syncronized to the backend #73

Open
ValentinKaisermayer opened this issue Jul 19, 2022 · 8 comments
Open

DateRange is not syncronized to the backend #73

ValentinKaisermayer opened this issue Jul 19, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@ValentinKaisermayer
Copy link

using Stipple, StippleUI

@reactive mutable struct DatePickers <: ReactiveModel
    date::R{Date} = today() + Day(30)
    daterange::R{DateRange} = DateRange(today(), (today() + Day(3)))
end

function ui(model)
  [
    page(
      model,
      class = "container",
      title = "Bug",
      partial = true,
      core_theme = true,
      [
        row(cell([h1("Date picker")]))
        row(
          [
            cell([
                datepicker(:date), 
            ])
            cell([
                datepicker(:daterange, range = true),
            ])
          ],
        )
      ],
    ),
  ]
end

model = DatePickers |> init

route("/") do
    html(ui(model), context = @__MODULE__)
end

up()

Changing the date range via the REPL updates the view model.daterange[] = DateRange(Date("2022-07-01"), Date("2022-07-05")) but the other way around does not work model.daterange[].

  [c43c736e] Genie v4.18.1
  [4acbeb90] Stipple v0.24.4
  [ec984513] StipplePlotly v0.12.4
  [a3c5d34a] StippleUI v0.19.4
@ValentinKaisermayer ValentinKaisermayer changed the title DateRange is not syncronized with to the backend DateRange is not syncronized to the backend Jul 19, 2022
@AbhimanyuAryan
Copy link
Member

yes looks like a bug. Thanks for reporting

@AbhimanyuAryan AbhimanyuAryan added the bug Something isn't working label Jul 19, 2022
@cwiese
Copy link

cwiese commented Jul 28, 2022

When I change dates via the UI and it does not fire the "on" model.daterange

@AbhimanyuAryan
Copy link
Member

thanks for reporting. I think there's something off with DateRange. I'll work on it today and debug the problem

@AbhimanyuAryan AbhimanyuAryan self-assigned this Aug 3, 2022
@cwiese
Copy link

cwiese commented Aug 10, 2022

I have this issue also :

using Revise
using Stipple, StipplePlotly, StippleUI
using PlotlyBase


@reactive! mutable struct Example <: ReactiveModel
    daterange::R{DateRange} = DateRange(Date(2022, 7, 7), Date(2022, 7, 14))
end

function ui(model::Example)
    page(model, class = "container", 
    row(class = "st-module", [
        datepicker(
            :daterange, range = true,
            ),
    ]))
end

function handlers(model)
  on(model.isready) do isready
      isready || return
      push!(model)
  end

  on(model.daterange) do data
      @info "datarange" daterange
  end

  return model
end


model = init(Example, debounce=0)

route("/") do
    model |> handlers |> ui |> html
end

up(8000)

@cwiese
Copy link

cwiese commented Aug 10, 2022

never fires change in observer

@ValentinKaisermayer
Copy link
Author

It seems to be that the back channel (view to backend) does not work properly.

@cwiese
Copy link

cwiese commented Aug 10, 2022

if I programmatically set the daterange[] it fires the observer. I was thinking the widget needs to "close" or "okay" when it sets new daterange. I have not look yet - but I intend to.

@ValentinKaisermayer
Copy link
Author

Maybe something goes wrong in the update
https://github.com/GenieFramework/Stipple.jl/blob/master/src/Stipple.jl#L836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants