Comments (5)
Hi @josevalim , here is the minimal repo to reproduce: https://github.com/goofansu/live_dashboard_playground
Steps:
- Start server with
mix phx.server
- Visit http://localhost:4000/dashboard
- No error
- Stop server but don't close the browser
- Start server with
mix phx.server
again, waiting for the LiveView's re-connecting from browser - The error
** (ArgumentError) assign @menu not available in eex template.
occurs
It seems the menu
assign is not persisted in cookie. But I cannot reproduce it with {:phoenix_live_dashboard, path: "~/src/phoenix_live_dashboard"}
where the phoenix_live_dashboard
is on v0.1.0 branch.
from phoenix_live_dashboard.
Having the same problem but dashboard seems work.
The error trace
[info] Running BrightuWeb.Endpoint with cowboy 2.7.0 at 0.0.0.0:4000 (http)
[info] Access BrightuWeb.Endpoint at http://localhost:4000
[info] CONNECTED TO Phoenix.LiveView.Socket in 161µs
Transport: :websocket
Serializer: Phoenix.Socket.V2.JSONSerializer
Parameters: %{"_csrf_token" => "Gx0WDm8UHDcHT1plGSYECBIhLBQLMisryHxY9FIe_-w24C5_uVNDEpdC", "vsn" => "2.0.0"}
[error] GenServer #PID<0.527.0> terminating
** (ArgumentError) assign @menu not available in eex template.
Please make sure all proper assigns have been set. If this
is a child template, ensure assigns are given explicitly by
the parent template as they are not automatically forwarded.
Available assigns: [:flash, :inner_content, :live_action, :live_module, :socket]
(phoenix_live_view 0.12.0) lib/phoenix_live_view/engine.ex:860: Phoenix.LiveView.Engine.fetch_assign!/2
(phoenix_live_dashboard 0.1.0) lib/phoenix/live_dashboard/templates/layout/live.html.leex:7: anonymous fn/2 in Phoenix.LiveDashboard.LayoutView."live.html"/1
(phoenix_live_view 0.12.0) lib/phoenix_live_view/diff.ex:221: Phoenix.LiveView.Diff.traverse/5
(phoenix_live_view 0.12.0) lib/phoenix_live_view/diff.ex:92: Phoenix.LiveView.Diff.render/3
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:504: Phoenix.LiveView.Channel.render_diff/2
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:199: Phoenix.LiveView.Channel.maybe_call_mount_handle_params/4
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:620: Phoenix.LiveView.Channel.verified_mount/4
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:34: Phoenix.LiveView.Channel.handle_info/2
(stdlib 3.12) gen_server.erl:637: :gen_server.try_dispatch/4
(stdlib 3.12) gen_server.erl:711: :gen_server.handle_msg/6
(stdlib 3.12) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:mount, Phoenix.LiveView.Channel}
State: {%{"flash" => nil, "joins" => 1, "params" => %{"_csrf_token" => "Gx0WDm8UHDcHT1plGSYECBIhLBQLMisryHxY9FIe_-w24C5_uVNDEpdC"}, "session" => "SFMyNTY.g2gDaAJhBHQAAAAHZAACaWRtAAAAFHBoeC1GZ2JZNjNnSFlEQ25iZ0ZoZAAKcGFyZW50X3BpZGQAA25pbGQACHJvb3RfcGlkZAADbmlsZAAJcm9vdF92aWV3ZAAlRWxpeGlyLlBob2VuaXguTGl2ZURhc2hib2FyZC5Ib21lTGl2ZWQABnJvdXRlcmQAGEVsaXhpci5CcmlnaHR1V2ViLlJvdXRlcmQAB3Nlc3Npb250AAAAAm0AAAAHbWV0cmljc2QAA25pbG0AAAAOcmVxdWVzdF9sb2dnZXJkAANuaWxkAAR2aWV3ZAAlRWxpeGlyLlBob2VuaXguTGl2ZURhc2hib2FyZC5Ib21lTGl2ZW4GANrsKIxxAWIAAVGA.MczQ-_m_peHABCrPDbLp_WpwlwJSW-0H0U3Ofhg_W90", "static" => "SFMyNTY.g2gDaAJhBHQAAAADZAAKYXNzaWduX25ld2pkAAVmbGFzaHQAAAAAZAACaWRtAAAAFHBoeC1GZ2JZNjNnSFlEQ25iZ0ZobgYA2uwojHEBYgABUYA.DVmNx8O6M2TN8SbWacYPrWet0mBxnzYeVYY6Z6iDQ4o", "url" => "http://localhost:4000/dashboard/nonode%40nohost"}, {#PID<0.524.0>, #Reference<0.3153342612.1519124482.123405>}, %Phoenix.Socket{assigns: %{}, channel: Phoenix.LiveView.Channel, channel_pid: nil, endpoint: BrightuWeb.Endpoint, handler: Phoenix.LiveView.Socket, id: nil, join_ref: "9", joined: false, private: %{session: %{}}, pubsub_server: BrightuWeb.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "lv:phx-FgbY63gHYDCnbgFh", transport: :websocket, transport_pid: #PID<0.524.0>}}
[error] an exception was raised:
** (ArgumentError) assign @menu not available in eex template.
Please make sure all proper assigns have been set. If this
is a child template, ensure assigns are given explicitly by
the parent template as they are not automatically forwarded.
Available assigns: [:flash, :inner_content, :live_action, :live_module, :socket]
(phoenix_live_view 0.12.0) lib/phoenix_live_view/engine.ex:860: Phoenix.LiveView.Engine.fetch_assign!/2
(phoenix_live_dashboard 0.1.0) lib/phoenix/live_dashboard/templates/layout/live.html.leex:7: anonymous fn/2 in Phoenix.LiveDashboard.LayoutView."live.html"/1
(phoenix_live_view 0.12.0) lib/phoenix_live_view/diff.ex:221: Phoenix.LiveView.Diff.traverse/5
(phoenix_live_view 0.12.0) lib/phoenix_live_view/diff.ex:92: Phoenix.LiveView.Diff.render/3
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:504: Phoenix.LiveView.Channel.render_diff/2
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:199: Phoenix.LiveView.Channel.maybe_call_mount_handle_params/4
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:620: Phoenix.LiveView.Channel.verified_mount/4
(phoenix_live_view 0.12.0) lib/phoenix_live_view/channel.ex:34: Phoenix.LiveView.Channel.handle_info/2
(stdlib 3.12) gen_server.erl:637: :gen_server.try_dispatch/4
(stdlib 3.12) gen_server.erl:711: :gen_server.handle_msg/6
(stdlib 3.12) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
FYI, it happens when re-connecting the liveview socket. If either "Metrics" or "Request Logger" is configured, the problem is gone.
But I cannot reproduce it with v0.1.0 branch in local:
- Clone phoenix_live_dashboard and checkout v0.1.0 branch
git clone [email protected]:phoenixframework/phoenix_live_dashboard.git
cd phoenix_live_dashboard
git checkout v0.1.0
- Modify mix.exs to use local phoenix_live_dashboard
defp deps do
[
{:phoenix, "~> 1.5.0-rc.0", override: true},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix_ecto, "~> 4.0"},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_dashboard, path: "~/src/phoenix_live_dashboard"},
{:telemetry_poller, "~> 0.4"},
{:telemetry_metrics, "~> 0.4"},
{:gettext, "~> 0.11"},
{:brightu, in_umbrella: true},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.1"}
]
end
from phoenix_live_dashboard.
I tried reproducing it locally and failed. Can someone push a small app to GitHub that reproduces the issue? Also, please provide your Phoenix+Elixir versions. Thanks!
from phoenix_live_dashboard.
Thank you so much @goofansu . Your steps helped me reproduce it and fix a LiveView bug!
from phoenix_live_dashboard.
@josevalim Cool, thanks! 🧡
from phoenix_live_dashboard.
Related Issues (20)
- Application Processes Dependency Graph HOT 2
- Protocol.UndefinedError: protocol Enumerable not implemented for {:EXIT, {{:badmatch, nil} ...} HOT 2
- Update components to the new LiveView 0.18 HOT 3
- Themes support HOT 5
- Add Memory Allocators tab
- Document use of Bootstrap for PageBuilder
- Do not use Logger.add_backend/2 from Elixir v1.15+ onwards
- Multiple nodes on fly.io seem to jump-redirect between them HOT 1
- hexdocs: missing screenshot HOT 1
- Modals not rendering maximize/minimize glyphs HOT 4
- Docs are out of sync with version 0.7.2 HOT 3
- Max carrier size column behaviour HOT 1
- Broken Links when using forward plug HOT 2
- Support Request Logger for live views
- Crash when mounting the dashboard on "/" HOT 1
- y
- Bad RPC call on first launch after adding `:os_mon` HOT 1
- Is there any reason why `live_chart` is marked as private? HOT 1
- Is it possible to use custom CSS framework? HOT 2
- Use Erlang/OTP 27 new proc_lib:set_label when printing processes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phoenix_live_dashboard.