asibbald

asibbald

Programming Phoenix LiveView B2.0: P168 "Render the Demographic Form"

A further clarification: When I move to the “Stateful components” section and run a compile with “iex -S mix”, the compile works. When I then try “mix phx.server” i get the same error as shown below. Interestingly, when I then went back to the stateless directory (where I had originally tried the “mix phx.server” and got the error below, I now got the same error when running “iex -S mix”

When attempting this, the server crashes with an error about @assign content not being available in the eex template. I have diffed all the files created following the book text with the ones in your code zip, but see no differences. Interestingly, the code in the “stateless_components” directory of the zip doesn’t compile either. I’ve copied the two sets of errors below.

I’ve moved on and I’m no longer trying to resolve this. Perhaps I have done something in error that I can’t see myself. But perhaps there is an error in the book’s code. Debugging this is beyond me.

Error when I attempt to compile the code in your zip file (downloaded today) under stateless_components:

== Compilation error in file lib/pento_web/live/product_live/show.ex ==
** (EEx.SyntaxError) /Users/alister/Programming/Practice/elixir/liveview/code/stateless_components/pento/lib/pento_web/live/product_live/show.html.leex:43:1: missing token ‘%>’
(eex 1.11.4) lib/eex/compiler.ex:37: EEx.Compiler.compile/2
(phoenix_live_view 0.15.1) expanding macro: Phoenix.LiveView.Renderer.before_compile/1
lib/pento_web/live/product_live/show.ex:9: PentoWeb.ProductLive.Show (module)
(elixir 1.11.4) lib/kernel/parallel_compiler.ex:314: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

Error when I attempt to run the code I created following the text in B2.0:

[error] #PID<0.18693.0> running PentoWeb.Endpoint (connection #PID<0.18691.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /survey
** (exit) an exception was raised:
** (ArgumentError) assign @content 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: [:changed, :changeset, :demographic, :flash, :id, :socket, :user]

    (phoenix_live_view 0.15.4) lib/phoenix_live_view/engine.ex:877: Phoenix.LiveView.Engine.fetch_assign!/2
    lib/pento_web/live/demographic_live/form_component.html.leex:1: anonymous fn/2 in PentoWeb.DemographicLive.FormComponent.render/1
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/diff.ex:356: Phoenix.LiveView.Diff.traverse/6
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/diff.ex:430: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/6
    (elixir 1.11.4) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/diff.ex:356: Phoenix.LiveView.Diff.traverse/6
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/diff.ex:430: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/6
    (elixir 1.11.4) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/diff.ex:356: Phoenix.LiveView.Diff.traverse/6
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/diff.ex:130: Phoenix.LiveView.Diff.render/3
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/static.ex:288: Phoenix.LiveView.Static.to_rendered_content_tag/4
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/static.ex:148: Phoenix.LiveView.Static.render/3
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/controller.ex:35: Phoenix.LiveView.Controller.live_render/3
    (phoenix 1.5.8) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
    (pento 0.1.0) lib/pento_web/endpoint.ex:1: PentoWeb.Endpoint.plug_builder_call/2
    (pento 0.1.0) lib/plug/debugger.ex:136: PentoWeb.Endpoint."call (overridable 3)"/2
    (pento 0.1.0) lib/pento_web/endpoint.ex:1: PentoWeb.Endpoint.call/2
    (phoenix 1.5.8) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
    (cowboy 2.8.0) /Users/alister/Programming/Practice/elixir/liveview/pento/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.8.0) /Users/alister/Programming/Practice/elixir/liveview/pento/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3

Popular Prag Prog topics Top

sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=&gt; (create-...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |&gt; handle_event() |&gt; render() but the correc...
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
digitalbias
Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on (page 64) If you follow the defau...
New
brunogirin
When I run the coverage example to report on missing lines, I get: pytest --cov=cards --report=term-missing ch7 ERROR: usage: pytest [op...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1122 25120 742
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
PragmaticBookshelf
Author Spotlight: Bruce Tate @redrapids Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New

Latest in PragProg

View all threads ❯