# JSServe crashing when recording plot of matrix views

**URL:** <https://discourse.julialang.org/t/jsserve-crashing-when-recording-plot-of-matrix-views/105053>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [October 17, 2023, 9:26am UTC](https://discourse.julialang.org/t/jsserve-crashing-when-recording-plot-of-matrix-views/105053 "2023-10-17T09:26:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sceptri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sceptri/32/52356_2.png) [@sceptri](https://discourse.julialang.org/u/sceptri)\
**Post date:** [October 17, 2023, 9:26am UTC](https://discourse.julialang.org/t/jsserve-crashing-when-recording-plot-of-matrix-views/105053/1 "2023-10-17T09:26:59Z")

</div>

Hello everyone,

consider the following MWE code

```julia
using Observables, JSServe, WGLMakie, Markdown

App() do session::Session
	n = Slider(5:10)
	xs = 1:10
	ys = rand(length(xs))

	fig = Figure()
	axis = Axis(fig[1,1])

	xshort = @lift view(xs, ($n) : length(xs))
	yshort = @lift view(ys, ($n) : length(ys))

	lines!(axis, xs, ys)
	lines!(axis, xshort, yshort)

	slider = DOM.div("Slider: ", n, n.value)
    return JSServe.record_states(session, DOM.div(slider, fig))
end

```

This code crashes on the error `ERROR: DimensionMismatch: arrays could not be broadcast to a common size; got a dimension with lengths 5 and 6` (I can include the full stacktrace if necessary)

I should also note that if you just write

```julia
n = Slider(5:10)
xs = 1:10
ys = rand(length(xs))

fig = Figure()
axis = Axis(fig[1,1])

xshort = @lift view(xs, ($n) : length(xs))
yshort = @lift view(ys, ($n) : length(ys))

lines!(axis, xs, ys)
lines!(axis, xshort, yshort)

display(fig)

```

then all works nice and well. Any idea why this happens?

Thanks a lot
