phoenixframework / phoenix_html

Building blocks for working with HTML in Phoenix
MIT License
403 stars 220 forks source link

Liveview push_patch not working starting from version 3.3.0 #417

Closed Szetty closed 1 year ago

Szetty commented 1 year ago

Basically since we changed to this version (3.3.0) our push_patch has stopped working on JS side.

We are seeing this error on version 3.3.0:

image

And inspecting the value, it is indeed null:

e55e7c49-f666-431f-9dff-d500a1ee5a0b

On version 3.2.0 we have this for the same value:

2c068544-2768-4230-aa1f-c8150dd5d094

Szetty commented 1 year ago

Started to debug more, and found that the problem is here: image

Basically this.main = view is not called for some reason. Although checking the rootEl I can see the attribute:

image

josevalim commented 1 year ago

What is your LiveView version? I am using 0.18.x and it definitely works here. You may need to update LiveView or keep using 3.2 until you can do so. :)

Szetty commented 1 year ago

Found the problem, it is related to this commit from what I understand: https://github.com/phoenixframework/phoenix_html/commit/4904ed1c5f0805c67d1e4ba11eb8603beaaf5745

Old version:

image

image

image

New version:

image

image

image

Szetty commented 1 year ago

What is your LiveView version? I am using 0.18.x and it definitely works here. You may need to update LiveView or keep using 3.2 until you can do so. :)

image

Szetty commented 1 year ago

Thank you @josevalim, found the phoenix_live_view commit fixing this : https://github.com/phoenixframework/phoenix_live_view/commit/604d0f740df7d386bdeb055d6194494e0ed5e558

Szetty commented 1 year ago

In conclusion in order to run phoenix_html > 3.3.0 you need phoenix_live_view > 0.18.4.

Sleepful commented 1 year ago

Had a similar issue. Updating the deps wasn't enough to fix it, but after running these commands it worked fine:

cd assets
rm -rf node_modules
npm i
cd ../
rm -rf _build
mix compile
mix phx.server