Skip to content

Commit

Permalink
Fix non-working comms when viewing a notebook with old WebIO content
Browse files Browse the repository at this point in the history
  • Loading branch information
halleysfifthinc committed Nov 27, 2024
1 parent 00d0420 commit 0556c09
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/providers/ijulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ function main()
@warn "IJulia doesn't have register_mime; WebIO may not work as expected. Please upgrade to IJulia v1.13.0 or greater."
end

# Delete any old comms before displaying the first WEBIO_NODE_MIME content (which prompts a new connection)
# Reason: If a freshly opened notebook has previously rendered WEBIO_NODE_MIME, an old comm is
# (incorrectly) registered from/by jupyter before WebIO has been init'ed
for (k,v) in IJulia.CommManager.comms
if IJulia.CommManager.comm_target(v) == :webio_comm
IJulia.CommManager.close_comm(v)
delete!(IJulia.CommManager.comms, k)
end
end

# See comment on _IJuliaInit for what this does
display(_IJuliaInit())
end
Expand Down

0 comments on commit 0556c09

Please sign in to comment.