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

Add unique ID to <bond> element to force re-render after bond definition #1827

Merged
merged 1 commit into from
Jan 18, 2022

Conversation

fonsp
Copy link
Owner

@fonsp fonsp commented Jan 18, 2022

This fixes the following situation, where a bond is placed inside a DivElement:

Schermopname.2022-01-18.om.13.04.00.mov

Because the HTML contents of the bond (<bond def=x><input type=range></bond>) are exactly the same, Pluto's frontend will do a partial re-render of the third cell, skipping the re-render of the sliders, since those are unchanged. This means that the bond value is not set.

This is a problem, because re-running a @bond expression will always remove the old bound value from Julia scope.

This PR will guarantee that re-running @bond will cause the HTML element to re-render, by including a random string (generated when the Bond is created) in the HTML output.

@github-actions
Copy link
Contributor

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="bond-unique-id")
julia> using Pluto

@fonsp fonsp merged commit 0884d29 into main Jan 18, 2022
@fonsp fonsp deleted the bond-unique-id branch January 18, 2022 12:07
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.

None yet

1 participant