New (sigil_p) route syntax complains about URL parameters

In my router, I have a live "/archive", ArchiveLive.FileIndex, :index (inside a live_session, if that matters)

But when the compiler tries to handle the sigil_r route ~p"/archive?#{url_params}", I get this compiler warning:

warning: no route path for MarsvinWeb.Router matches "/archive?#{url_params}"

Do I need to add something to the route to make it clear that it accepts URL parameters, or what’s going on here?

@mikl If you do mix phx.routes |grep archive what do you get?

Full output:

% mix phx.routes | grep archive
warning: no route path for MarsvinWeb.Router matches "/archive?#{url_params}"
  lib/marsvin_web/live/archive_live/file_index.ex:123: MarsvinWeb.ArchiveLive.FileIndex.handle_event/3

  GET  /archive/file/:id/download               MarsvinWeb.ArchiveController :download_file
  GET  /archive                                 MarsvinWeb.ArchiveLive.FileIndex :index_pointing_at_the_viewer: 

Looks fairly normal?

The problem appeared after we upgraded to phoenix_live_view 0.18.13 and phoenix_html 3.3.0. If we go back to 0.18.11 and 3.2.0 the warnings disappear. Weird.

Looks to be a known issue, Github issue: no route path warnings after upgrade to 0.18.12 and phx 1.7 RC · Issue #2444 · phoenixframework/phoenix_live_view · GitHub

Should be solved in the next 1.7 RC.

1 Like