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

Fix Bonds.possible_values(::MultiSelect) #260

Merged
merged 2 commits into from
Jul 18, 2023
Merged

Fix Bonds.possible_values(::MultiSelect) #260

merged 2 commits into from
Jul 18, 2023

Conversation

Pangoraw
Copy link
Member

@Pangoraw Pangoraw commented May 31, 2023

subarrays should take an indexable Vector as input, not any generator.

  • Also MultiCheckBox

`subarrays` takes an indexable `Vector` as input, not any generator.
@github-actions
Copy link

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="/~https://github.com/JuliaPluto/PlutoUI.jl", rev="ms_possible_values")
julia> using PlutoUI

Or run this code in your browser: Run with binder

@Pangoraw Pangoraw requested a review from fonsp May 31, 2023 20:16
@Pangoraw Pangoraw marked this pull request as ready for review May 31, 2023 20:16
@fonsp
Copy link
Member

fonsp commented Jun 7, 2023

ooh what does this fix again?

the precomputed plutosliderswrrver has a second issue that this is a lazy object (on purpose) but pss does not work with that yet. i started working on it but still need to finish it

@Pangoraw
Copy link
Member Author

Pangoraw commented Jun 7, 2023

This fixes the generator which currently fails to generate possible values:

julia> PlutoUI.BuiltinsNotebook.Bonds.possible_values(MultiSelect([1, 2, 3])) |> collect
ERROR: MethodError: no method matching getindex(::Base.Generator{UnitRange{Int64}, PlutoUI.BuiltinsNotebook.var"#48#52"}, ::Vector{Bool})
Stacktrace:
 [1] (::PlutoUI.BuiltinsNotebook.var"#33#34"{Base.Generator{UnitRange{Int64}, PlutoUI.BuiltinsNotebook.var"#48#52"}})(I::Tuple{Bool, Bool, Bool})
   @ PlutoUI.BuiltinsNotebook ./none:0
 [2] iterate
   @ ./generator.jl:47 [inlined]
 [3] collect
   @ ./array.jl:782 [inlined]
 [4] |>(x::Base.Generator{Vector{Tuple{Bool, Bool, Bool}}, PlutoUI.BuiltinsNotebook.var"#33#34"{Base.Generator{UnitRange{Int64}, PlutoUI.BuiltinsNotebook.var"#48#52"}}}, f::typeof(collect))
   @ Base ./operators.jl:907
 [5] top-level scope
   @ REPL[8]:1

The output of possible_values(::MultiSelect) is still a generator but it can now be collected as shown in tests.

@fonsp fonsp merged commit 502afe7 into main Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants