GithubHelp home page GithubHelp logo

Comments (6)

nelsonic avatar nelsonic commented on July 3, 2024 2

Attempted to add put_root_layout to :browser pipeline in router.ex as instructed in the changelog.

Getting:

== Compilation error in file lib/live_view_counter_web/router.ex ==
** (CompileError) lib/live_view_counter_web/router.ex: undefined function put_root_layout/2
    (elixir 1.10.1) src/elixir_locals.erl:114: anonymous fn/3 in :elixir_locals.ensure_no_undefined_local/3
    (stdlib 3.11.2) erl_eval.erl:680: :erl_eval.do_apply/6

There are only 6 Google search results for "phoenix put_root_layout":
https://www.google.com/search?q=phoenix+put_root_layout

google-search-phoenix-put_root_layout

I've read through all 6 results and put_root_layout is a function in the controller.ex
image

it looks like the Phoenix generator
is about to have a new --live option as in:

mix phx.new --live

See: phoenixframework/phoenix#3680

That will significantly reduce the number of setup steps.
I'm going to keep my eyes on the phoenix releases https://github.com/phoenixframework/phoenix/releases
and if a new version is released I will revisit this.

from phoenix-liveview-counter-tutorial.

nelsonic avatar nelsonic commented on July 3, 2024 1
** (exit) an exception was raised:
    ** (ArgumentError) assign @conn not available in eex template.

Replaced all instances of @conn in lib/live_view_counter_web/templates/layout/app.html.leex

Now seeing the following error:

[error] GenServer #PID<0.486.0> terminating
** (ArgumentError) :flash is a reserved assign by LiveView and it cannot be set directly. Use the appropriate flash functions instead.
    (phoenix_live_view 0.9.0) lib/phoenix_live_view.ex:1425: Phoenix.LiveView.validate_assign_key!/1
    (phoenix_live_view 0.9.0) lib/phoenix_live_view.ex:1419: anonymous fn/2 in Phoenix.LiveView.assign/2
    (stdlib 3.11.2) maps.erl:232: :maps.fold_1/3
    (live_view_counter 0.9.0) lib/live_view_counter_web/live/counter.ex:25: LiveViewCounterWeb.Counter.handle_info/2
    (phoenix_live_view 0.9.0) lib/phoenix_live_view/channel.ex:113: Phoenix.LiveView.Channel.handle_info/2
    (stdlib 3.11.2) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.11.2) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Broadcast{event: "inc", payload: %{flash: %{}, live_view_action: nil, live_view_module: LiveViewCounterWeb.Counter, val: 1}, topic: "live"}
State: %{components: {%{}, %{}, 0}, join_ref: "4", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<assigns: %{flash: %{}, live_view_action: nil, live_view_module: LiveViewCounterWeb.Counter, val: 0}, changed: %{}, endpoint: LiveViewCounterWeb.Endpoint, id: "phx-FfsCpTRMyIBxyQBh", parent_pid: nil, root_pid: #PID<0.486.0>, router: LiveViewCounterWeb.Router, view: LiveViewCounterWeb.Counter, ...>, topic: "lv:phx-FfsCpTRMyIBxyQBh", transport_pid: #PID<0.483.0>, uri: %URI{authority: nil, fragment: nil, host: "localhost", path: nil, port: 4000, query: nil, scheme: "http", userinfo: nil}}

The line in the code is:

 %Phoenix.Socket.Broadcast{
  event: "inc",
  payload: %{
    flash: %{},
    live_view_action: nil,
    live_view_module: LiveViewCounterWeb.Counter,
    val: 1
  },
  topic: "live"
}

After a bit of debugging I figured it out! 🙌

from phoenix-liveview-counter-tutorial.

nelsonic avatar nelsonic commented on July 3, 2024 1

Fixed in #6 :shipit:

from phoenix-liveview-counter-tutorial.

nelsonic avatar nelsonic commented on July 3, 2024

Reading: https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-live-layouts 👀

from phoenix-liveview-counter-tutorial.

nelsonic avatar nelsonic commented on July 3, 2024

Once #4 is merged we will be able to open an issue on https://github.com/phoenixframework/phoenix_live_view/issues with a full explanation and steps to reproduce!

from phoenix-liveview-counter-tutorial.

nelsonic avatar nelsonic commented on July 3, 2024

Reading: https://github.com/phoenixframework/phoenix_live_view/blob/master/CHANGELOG.md 👀

from phoenix-liveview-counter-tutorial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.