Skip to content

Are on_mount hooks not supported? #9

@doughsay

Description

@doughsay

Hey, amazing project! I love it for doing quick tests when helping people out in the discord server.

I tried this, and it appears the on_mount hook is never called. Is this intended right now?

Mix.install([
  {:phoenix_playground, "~> 0.1.0"}
])

defmodule Demo.Hooks do
  def on_mount(:default, _params, _session, socket) do
    dbg("on_mount!")
    {:cont, socket}
  end
end

defmodule Demo.Live do
  use Phoenix.LiveView

  on_mount(Demo.Hooks)

  def mount(_params, _session, socket) do
    dbg("mount!")
    {:ok, socket}
  end

  def render(assigns) do
    ~H"""
    <p>Hello!</p>
    """
  end
end

PhoenixPlayground.start(live: Demo.Live)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions