Curious if this is a bug or just a mistake I made and I’m not noticing!
Using Phoenix 1.7.10
I have this liveview module:
defmodule MyAppWeb.SearchLive do
use MyAppWeb, :live_view
def mount(_params, _session, socket) do
{:ok, socket}
end
end
And in my router, the /search
route is broken because for some reason Phoenix is looking for the wrong module name with MyAppWeb
listed twice!
scope "/", MyAppWeb do
pipe_through [:browser]
delete "/users/log_out", UserSessionController, :delete
live_session :current_user,
on_mount: [{MyAppWeb.UserAuth, :mount_current_user}] do
live "/users/confirm/:token", UserConfirmationLive, :edit
live "/users/confirm", UserConfirmationInstructionsLive, :new
live "/search", SearchLive # BROKEN
live "/searchx", SearchLivexxx # Adds MyAppWeb only once, good.
live "/pineapple", SearchLive # Still adding it twice!
end
end
By visiting a gibberish URL I can see the routes Phoenix knows and check this out:
GET /search MyAppWeb.MyAppWeb.SearchLive MyAppWeb.MyAppWeb.SearchLive
GET /searchx MyAappWeb.SearchLivexxx MyAappWeb.SearchLivexxx
GET /pineapple MyAppWeb.MyAppWeb.SearchLive MyAppWeb.MyAppWeb.SearchLive
Why is phoenix adding MyAppWeb
twice to the module it’s trying to find?