Phoenix 1.7.0-rc.0 is out!

Issues have been resolved in Bandit 0.6.0, just released a moment ago.

4 Likes

Is anyone else having problems with a dead view web page not automatically reloading. I can see my changes being recompiled but the browser doesn’t automatically get refreshed.

Tried it with a Live View and it works fine - just seems to be a problem with views from a controller.

1 Like

In case updated your Mac and Phoenix, I faced the same issue:

Try: mix deps.compile file_system (So your live reload will work!)

1 Like

Thankd for the tip @derpycoder but that didn’t work. I suspect it is something to do with 1.7 itself as an older app I have works fine. Not sure if anyone else is getting this issue.

Live reload seems to be working for me with dead views.

I had to update live reload patterns in config.dev.exs, like this

config :seven, SevenWeb.Endpoint,
  live_reload: [
    patterns: [
      ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ~r"lib/seven_web/(live|views)/.*(ex)$",
      # ~r"lib/seven_web/templates/.*(eex)$"
      # HERE -->
      ~r"lib/seven_web/components/.*(eex)$",
      ~r"lib/seven_web/controllers/.*(eex)$"
    ]
  ]

You might not need to do this if You update an older project to 1.7

5 Likes

upgrading to 1.7.0-rc.0, updated most of the stuff hopefully this is the only error left
undefined function text_input/3

got this in my live_view.html.heex

  <.form :let={f} for={:filter} action="#" phx-change="filter" phx-submit="ignore">
    <%= text_input(f, :term,
      class: "form-control form-control-lg mb-3 col",
      phx_debounce: 100,
      placeholder: "Incoming Message Filter",
      value: @term
    ) %>
  </.form>

in phoenix 1.6.14 I had import Phoenix.LiveView.Helpers in view_helpers which is now html_helpers. I have added it there but seems it doesn’t work. Is there any change needed for live view ?

Thanks @kokolegorille. I tweaked my list of patterns and added:

  ~r"lib/wobble_web/controllers/.*(ex)$",
  ~r"lib/wobble_web/controllers/.*(heex)$",

and that did the trick. Cheers for the help.

5 Likes

@kokolegorille @shortlyportly

Thanks a lot was having the exact same problem on a fresh new project with no changes (modifying home.html.heex wasn’t updating the browser).

I thought it was because of some extension but even disabling all extensions wasn’t working.

I added the first line only of you snippet and it works.

Maybe it should be enabled by default in a new project?

I would say the first pattern match heex already ?!

Yes it seems to. At least it works with only the first line if I modify a .heex file.

But should this line be added to a default project? I think it should be?

It is probably a good candidate for a PR…

This should cover that:

3 Likes

Hum my dev.exs doesn’t seem to be the same. I have a (live/views)/.(.ex) line and a templates/.(.eex) line

There was already a PR, it has been approved and will be in the next release, I guess

Oh yes sorry didn’t check the GitHub link it was merged 7 days ago. Perfect :+1:

How to generate url query string with verfified routes? Somehow it is keeps complaining about stuff like this:

query_string = [
    context: "resume_onboarding",
    user_return_to: ~p"/onboarding/#{session}/#{highest_valid_step}"
  ]

  {:ok,
   socket
   |> push_redirect(to: ~p"/users/login?#{query_string}")}
[{
	"owner": "_generated_diagnostic_collection_name_#0",
	"severity": 8,
	"message": "(ArgumentError) expected query string param to be compile-time map or keyword list, got: \"/users/login?#{query_string}\"\n\nStacktrace:\n  │ (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:625: Phoenix.VerifiedRoutes.raise_invalid_query/1\n  │ (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:548: Phoenix.VerifiedRoutes.verify_segment/3\n  │ (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:714: Phoenix.VerifiedRoutes.rewrite_path/4\n  │ (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:700: Phoenix.VerifiedRoutes.build_route/5\n  │ (phoenix 1.7.0-rc.0) expanding macro: Phoenix.VerifiedRoutes.sigil_p/2\n  │ lib/myapp_web/live/onboarding/new.ex:51: MyAppWeb.OnboardingLive.New.mount/3\n  │ (elixir 1.14.1) expanding macro: Kernel.|>/2\n  │ lib/myapp_web/live/onboarding/new.ex:51: MyAppWeb.OnboardingLive.New.mount/3",
	"source": "Elixir",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1
}]

dynamic query interpolations work, so can you provide the complete example and complete stacktrace? We’re missing something here to say what’s going on. Thanks!

Using the input component from the new core_components.ex module instead of your text_input should work like a charm (with just a bit of rewrite) :

1 Like

Ok sorry, I was already little tired while writing. This seems to be more an issue of vscode + ElixirLS extension. The app compiles and works as expected. But this issue always pops up in Problems / Output tabs in vscode. Anyway the stacktrace is the following:

== Compilation error in file lib/myapp_web/live/onboarding/new.ex ==
** (ArgumentError) expected query string param to be compile-time map or keyword list, got: "/users/login?#{query_string}"
    (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:625: Phoenix.VerifiedRoutes.raise_invalid_query/1
    (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:548: Phoenix.VerifiedRoutes.verify_segment/3
    (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:714: Phoenix.VerifiedRoutes.rewrite_path/4
    (phoenix 1.7.0-rc.0) lib/phoenix/verified_routes.ex:700: Phoenix.VerifiedRoutes.build_route/5
    (phoenix 1.7.0-rc.0) expanding macro: Phoenix.VerifiedRoutes.sigil_p/2
    lib/myapp_web/live/onboarding/new.ex:51: MyAppWeb.OnboardingLive.New.mount/3
    (elixir 1.14.1) expanding macro: Kernel.|>/2
    lib/myapp_web/live/onboarding/new.ex:51: MyAppWeb.OnboardingLive.New.mount/3
4 Likes