JS.Navigate/Patch() and verified routes

I’m working with verified routes and I ran into an issue when using JS.Patch and JS.Navigate

Compiling 1 file (.ex)

== Compilation error in file lib/inspection_go_web/live/settings_live/employees.ex ==
** (CompileError) lib/app/live/settings_live/employees.ex:92: invalid args for &, expected one of:

  * &Mod.fun/arity to capture a remote function, such as &Enum.map/2
  * &fun/arity to capture a local or imported function, such as &is_atom/1
  * &some_code(&1, ...) containing at least one argument as &1, such as &List.flatten(&1)

Got: Phoenix.LiveView.JS.navigate(~p"/company/#{company}/settings/employees")
    (stdlib 4.3) lists.erl:1462: :lists.mapfoldl_1/3
    (phoenix_live_view 0.18.18) expanding macro: Phoenix.LiveView.TagEngine.inner_block/2

** (CompileError) lib/app/live/settings_live/employees.ex:92: invalid args for &, expected one of:

  * &Mod.fun/arity to capture a remote function, such as &Enum.map/2
  * &fun/arity to capture a local or imported function, such as &is_atom/1
  * &some_code(&1, ...) containing at least one argument as &1, such as &List.flatten(&1)

Got: Phoenix.LiveView.JS.navigate(~p"/company/#{company}/settings/employees")
    (stdlib 4.3) lists.erl:1462: :lists.mapfoldl_1/3
    (phoenix_live_view 0.18.18) expanding macro: Phoenix.LiveView.TagEngine.inner_block/2

I’ve looked around and not been able to find anything online, in docs or in general, and I’ve also tried each of the suggestions that were output with the same error being thrown. Just wondering if anyone here may have run into this or if maybe I overlooked documentation somewhere.

Thanks!

Hi @jmarkle52 any time you have an error please post the code alongside nearby context.

Sorry about that @benwilson512 , I got sucked into another bug.

I have a row_click that can be assigned to and MDC Table component, and I was initially using a capture operator to infer the employee_id

row_click={&JS.patch(~p"/company/#{@company}/settings/employees/&1/edit")}

I wasn’t paying attention to how I was using it though. Since it’s a call to something being embedded in the string, I needed to wrap it like I would anything else in that circumstance:

row_click={&JS.patch(~p"/company/#{@company}/settings/employees/#{&1}/edit")}

In doing so, all my routes are working from the items output. Just a simple miss on my part.