surface-ui/surface_catalogue

UndefinedFunctionError at GET /catalogue > function nil.live_path/2 is undefined

Opened this issue · 0 comments

rsieb commented

Hello all, am trying to make SurfaceUI and SurfaceCatalogue work on a Phoenix 1.7.0-rc.0 installation. I've had it work properly on a Phoenix 1.6 installation before.

Describe the bug

On calling localhost:4000/catalogue I get:

UndefinedFunctionError: function nil.live_path/2 is undefined

Digging into the error report I see a "nofile" error:

`nofile`

    No code available.

  Called with 2 arguments

  * `#Phoenix.LiveView.Socket<id: "phx-FzyLTCcAw6fKCgAJ", endpoint: CarolistWeb.Endpoint, view: Surface.Catalogue.PageLive, parent_pid: nil, root_pid: nil, router: CarolistWeb.Router, assigns: #Phoenix.LiveView.Socket.AssignsNotInSocket<>, transport_pid: nil, ...>`
  * `Surface.Catalogue.PageLive`
  
`lib/surface/catalogue/components/component_tree.ex`

    23     def render_node(assigns, node, selected_component, single_catalogue?, parent_keys \\ []) do
    24       ~F"""
    25       <ul class={"menu-list", "is-hidden": !show_nodes?(parent_keys, selected_component, single_catalogue?)}>
    26         <li :if={parent_keys == []}>
    27           <LivePatch
    28>            to={@socket.router.__helpers__().live_path(@socket, Surface.Catalogue.PageLive)}
    29             class={"has-text-weight-bold": !selected_component}
    30           >
    31             <span class="icon">
    32               <i class="fa fa-home" />
    33             </span>

How to reproduce it

  1. Set up a new Phoenix 1.7RC0 instance
  2. Add dependencies: {:surface, "> 0.9.0"}, {:surface_catalogue, "> 0.5.2"}, {:phoenix_view, "~> 2.0"} (phoenix_view because otherwise surface_catalogue errors on missing view functions)
  3. Run mix surface.init --demo --catalogue
  4. Run mix phx.server and see the error occur
  5. Or in the browser, go to http://localhost:4000/catalogue and see the error occur

The behavior you expected

Would have expected http://localhost:4000/catalogue to show me a demo catalogue

Your Environment

Surface: v0.9.0
SurfaceCatalogue: v0.5.2
LiveView: v0.18.3
Elixir: v1.14.1

Full error log attached below

UndefinedFunctionError_at_GET_|catalogue.md