mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-08 14:04:31 +08:00
Fix JS output export when data includes structs
This commit is contained in:
parent
a0a3f548fe
commit
ef25a2e24b
2 changed files with 7 additions and 3 deletions
|
@ -413,7 +413,7 @@ defmodule Livebook.LiveMarkdown.Export do
|
|||
end
|
||||
end
|
||||
|
||||
defp ensure_order(%{} = map) do
|
||||
defp ensure_order(%{} = map) when not is_struct(map) do
|
||||
map
|
||||
|> Enum.sort()
|
||||
|> Enum.map(fn {key, value} -> {key, ensure_order(value)} end)
|
||||
|
|
|
@ -903,7 +903,11 @@ defmodule Livebook.LiveMarkdown.ExportTest do
|
|||
ref: "1",
|
||||
pid:
|
||||
spawn_widget_with_data("1", %{
|
||||
spec: %{"height" => 50, "width" => 50},
|
||||
spec: %{
|
||||
"height" => 50,
|
||||
"width" => 50,
|
||||
"data" => %{"x" => 1, "y" => 1, "date" => ~D[2024-05-24]}
|
||||
},
|
||||
datasets: []
|
||||
}),
|
||||
assets: %{archive_path: "", hash: "abcd", js_path: "main.js"}
|
||||
|
@ -929,7 +933,7 @@ defmodule Livebook.LiveMarkdown.ExportTest do
|
|||
<!-- livebook:{"output":true} -->
|
||||
|
||||
```vega-lite
|
||||
{"height":50,"width":50}
|
||||
{"data":{"date":"2024-05-24","x":1,"y":1},"height":50,"width":50}
|
||||
```
|
||||
"""
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue