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

Running into similar no route path warning when using ~p"/#{@page_path}" and it displays in the warning as /#{assigns.page_path} but it runs on the local server as expected.

Running phx 1.7.2 and lv 0.18.18.

Can you provide more information? What is @page_path and what are your routes? Also note that verified routes need to match segment by segment. So if you have /posts/:id, you need to do ~p"/posts/#{}". If you try to interpolate the whole route as “/posts/123”, then there is nothing we can do to verify it (and then you should just remove ~p).

1 Like

That makes so much sense! I was using it to interpolate the whole path for a pagination component. Thank you :heart: