
jack.lansing
Programming Phoenix LiveView: 'update_changeset' not referenced + small leex typo (page 139)
Hi there,
Just wanted to call out that although what needs to happen should be pretty obvious, when we add handle_progress/3
on page 138-139 (shown below), the update_changeset/3
function we use when the upload completes is not mentioned before or after adding this function. It is in the source code for the book but when coding along you just kind of end up with this missing function not mentioned in the text (as far as I can tell).
defp handle_progress(:image, entry, socket) do
# :timer.sleep(1000)
if entry.done? do
path =
consume_uploaded_entry(
socket,
entry,
&upload_static_file(&1, socket)
)
{:noreply,
socket
|> put_flash(:info, "file #{entry.client_name} uploaded")
|> update_changeset(:image_upload, path)}
else
{:noreply, socket}
end
end
Smaller thing on this same page, the example for adding our image to the show template had the img tag not formatted correctly. Notice the ‘>’ after alt attribute as well as not having a closing tag after we add the src.
<article class="column">
<img
alt="product image" width="200" height="200">
src="<%=Routes.static_path(
@socket,
@product.image_upload || "/images/default-thumbnail.jpg")%>"
</article>
<!-- product details... -->
Thanks!
Marked As Solved

SophieDeBenedetto
Thank you so much for pointing these out! You’ll find both issues fixed in an upcoming Beta release, if not the next one, then the one after that
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /centos
- /ash
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /django
- /spring
- /diversity
- /nodejs
- /lua
- /slackware
- /julia
- /c
- /neovim