title: Why do I get a StackOverflowError when sending a Plotly figure to a Dash app?
body: <p>Adapting the second example from <a href="https://dash-julia.plotly.com/getting-started" rel="nofollow noreferrer">https://dash-julia.plotly.com/getting-started</a> as shown below, I get a StackOverflowError. Is the example not up to date or is there something wrong with my code or installation?</p>
  <p>Note that adding the figure as a tuple of data works (commented out in the code sample), but using the PlotlyJS.SyncPlot struct returned from plot does not. I can also display the figure in VSCode without any issues.</p>
  <pre><code>using DataFrames, PlotlyJS
  using Dash, DashHtmlComponents, DashCoreComponents
  using Random
  
  ydata = [rand() for i in 1:4]
  
  app = dash()
  
  app.layout = html_div() do
      dcc_graph(
          id=&quot;example-graph&quot;,
          # figure = (data = [(y = ydata,)],)   # Works
          figure = plot(ydata)  # Does not work
      )
  end
  
  run_server(app, &quot;0.0.0.0&quot;, debug=true)
  </code></pre>
  <p>Here is the stacktrace as requested:</p>
  <pre><code>┌ Error: error handling request
  │   exception =
  │    StackOverflowError:
  │    Stacktrace:
  │         [1] (::JSON2.var&quot;#3#4&quot;{DataType})(x::Vector{Any})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:11
  │         [2] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:75 [inlined]
  │         [3] write(io::IOBuffer, obj::Observables.Observable{Dict{Any, Any}}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94
  │         [4] write
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94 [inlined]
  │         [5] write(io::IOBuffer, obj::Tuple{Observables.Observable{Dict{Any, Any}}, Nothing}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:39
  │         [6] write(io::IOBuffer, obj::Tuple{Observables.Observable{Dict{Any, Any}}, Nothing})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:35
  │         [7] write(io::IOBuffer, obj::Dict{String, Tuple{Observables.AbstractObservable, Union{Nothing, Bool}}}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:24
  │         [8] write(io::IOBuffer, obj::Dict{String, Tuple{Observables.AbstractObservable, Union{Nothing, Bool}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:17
  │         [9] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:75 [inlined]
  │        [10] write(io::IOBuffer, obj::WebIO.Scope; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94
  │        [11] write(io::IOBuffer, obj::WebIO.Scope)
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94
  │    --- the last 3 lines are repeated 1 more time ---
  │        [15] write(io::IOBuffer, obj::Vector{Any}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:39
  │        [16] write(io::IOBuffer, obj::Vector{Any})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:35
  │    --- the last 15 lines are repeated 2208 more times ---
  │     [33137] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:75 [inlined]
  │     [33138] write(io::IOBuffer, obj::Observables.Observable{Dict{Any, Any}}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94
  │     [33139] write
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94 [inlined]
  │     [33140] write(io::IOBuffer, obj::Tuple{Observables.Observable{Dict{Any, Any}}, Nothing}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:39
  │     [33141] write(io::IOBuffer, obj::Tuple{Observables.Observable{Dict{Any, Any}}, Nothing})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:35
  │     [33142] write(io::IOBuffer, obj::Dict{String, Tuple{Observables.AbstractObservable, Union{Nothing, Bool}}}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:24
  │     [33143] write(io::IOBuffer, obj::Dict{String, Tuple{Observables.AbstractObservable, Union{Nothing, Bool}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:17
  │     [33144] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:75 [inlined]
  │     [33145] write(io::IOBuffer, obj::WebIO.Scope; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94
  │     [33146] write(io::IOBuffer, obj::WebIO.Scope)
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:94
  │    --- the last 3 lines are repeated 1 more time ---
  │     [33150] write(io::IOBuffer, obj::Dict{Symbol, Any}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:24
  │     [33151] write(io::IOBuffer, obj::Dict{Symbol, Any})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:17
  │     [33152] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:75 [inlined]
  │     [33153] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\JSON2.jl:0 [inlined]
  │     [33154] write(io::IOBuffer, obj::Component; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ DashBase C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\JSON2.jl:127
  │     [33155] write(io::IOBuffer, obj::Component)
  │           @ DashBase C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\JSON2.jl:127
  │     [33156] write(io::IOBuffer, obj::Dict{Symbol, Any}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:24
  │     [33157] write(io::IOBuffer, obj::Dict{Symbol, Any})
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:17
  │     [33158] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:75 [inlined]
  │     [33159] macro expansion
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\JSON2.jl:0 [inlined]
  │     [33160] write(io::IOBuffer, obj::Component; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  │           @ DashBase C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\JSON2.jl:127
  │     [33161] write
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\JSON2.jl:127 [inlined]
  │     [33162] #write#5
  │           @ C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:14 [inlined]
  │     [33163] write(obj::Component)
  │           @ JSON2 C:\Users\Martin\.julia\packages\JSON2\ld4Kq\src\write.jl:14
  │     [33164] process_layout(request::HTTP.Messages.Request, state::Dash.HandlerState)
  │           @ Dash C:\Users\Martin\.julia\packages\Dash\66VCI\src\handler\processors\layout.jl:4
  │     [33165] try_handle
  │           @ C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\router.jl:51 [inlined]
  │     [33166] try_handle(route::Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_layout)}}, path::SubString{String}, request::HTTP.Messages.Request, args::Dash.HandlerState)
  │           @ Dash.HttpHelpers C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\router.jl:97
  │     [33167] _handle
  │           @ C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\router.jl:101 [inlined]
  │     [33168] handle(route_tuple::Tuple{Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_layout)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_dependencies)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_reload_hash)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{Tuple{Int64, String}}, NamedTuple{(:path, :namespace), Tuple{Int64, Int64}}}, typeof(Dash.process_resource)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{Tuple{Int64, String}}, NamedTuple{(:file_path,), Tuple{Int64}}}, typeof(Dash.process_assets)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_callback)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Dash.process_index)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_index)}}}, path::SubString{String}, request::HTTP.Messages.Request, args::Dash.HandlerState)     
  │           @ Dash.HttpHelpers C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\router.jl:112
  │     [33169] handle(router::Dash.HttpHelpers.Router, request::HTTP.Messages.Request, args::Dash.HandlerState)
  │           @ Dash.HttpHelpers C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\router.jl:129
  │     [33170] (::Dash.HttpHelpers.var&quot;#1#2&quot;{Dash.HttpHelpers.Router, Dash.HandlerState})(::HTTP.Messages.Request)
  │           @ Dash.HttpHelpers C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\handlers.jl:4
  │     [33171] handle
  │           @ C:\Users\Martin\.julia\packages\HTTP\5e2VH\src\Handlers.jl:254 [inlined]
  │     [33172] (::Dash.HttpHelpers.var&quot;#7#8&quot;{Dash.var&quot;#71#73&quot;{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var&quot;#1#2&quot;{Dash.HttpHelpers.Router, Dash.HandlerState}}})(::HTTP.Messages.Request)
  │           @ Dash.HttpHelpers C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\handlers.jl:48
  │     [33173] handle
  │           @ C:\Users\Martin\.julia\packages\HTTP\5e2VH\src\Handlers.jl:254 [inlined]
  │     [33174] (::Dash.HttpHelpers.var&quot;#4#5&quot;{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var&quot;#7#8&quot;{Dash.var&quot;#71#73&quot;{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var&quot;#1#2&quot;{Dash.HttpHelpers.Router, Dash.HandlerState}}}}})(::HTTP.Messages.Request)
  │           @ Dash.HttpHelpers C:\Users\Martin\.julia\packages\Dash\66VCI\src\HttpHelpers\handlers.jl:27
  │     [33175] handle
  │           @ C:\Users\Martin\.julia\packages\HTTP\5e2VH\src\Handlers.jl:254 [inlined]
  │     [33176] handle(::HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var&quot;#4#5&quot;{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var&quot;#7#8&quot;{Dash.var&quot;#71#73&quot;{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var&quot;#1#2&quot;{Dash.HttpHelpers.Router, Dash.HandlerState}}}}}}, ::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
  │           @ HTTP.Handlers C:\Users\Martin\.julia\packages\HTTP\5e2VH\src\Handlers.jl:277
  │     [33177] #4
  │           @ C:\Users\Martin\.julia\packages\HTTP\5e2VH\src\Handlers.jl:346 [inlined]
  │     [33178] macro expansion
  │           @ C:\Users\Martin\.julia\packages\HTTP\5e2VH\src\Servers.jl:413 [inlined]
  └ @ Dash C:\Users\Martin\.julia\packages\Dash\66VCI\src\handler\make_handler.jl:110
  </code></pre>