JuliaPluto / PlutoUI.jl

https://featured.plutojl.org/basic/plutoui.jl
The Unlicense
299 stars 54 forks source link

Select `possible_values` does not match option values #292

Closed ctrekker closed 4 months ago

ctrekker commented 4 months ago

I'm having issues with precomputing select inputs. Here's an example: the client requests a new state based on the following decoded patch:

Dict{Any, Any} with 1 entry:
  "my_select_box" => Dict{Any, Any}("value"=>"puiselect-4")

But precomputed inputs uses possible_values, which expects a decoded patch that looks like:

Dict{Any, Any} with 1 entry:
  "my_select_box" => Dict{Any, Any}("value"=>"4")

My guess is this was introduced by https://github.com/JuliaPluto/PlutoUI.jl/commit/dec4333497d2e15aaed0173c330d8a7121a7b4aa, and that we should update

Bonds.possible_values(select::Select) = (string(i) for i in 1:length(select.options))

to

Bonds.possible_values(select::Select) = ("puiselect-$i" for i in 1:length(select.options))
fonsp commented 4 months ago

Yep, good catch! Make a commit and release if you like