dfalling
Colocated hooks not including hook name
I’m trying to move to colocated hooks following the LiveView 1.1 Changelog.
I think I made all the necessary changes, but when my colocated hooks compile, they’re named simply ModuleName. The hook name is nowhere to be seen. Did I miss a crucial step of the migration, or is there something else I’m doing wrong?
Example hook:
defmodule IdoWeb.EmojiComponents do
use Phoenix.Component
alias Phoenix.LiveView.ColocatedHook
def input(assigns) do
~H"""
<span>
<input
id={@id}
phx-hook=".EmojiInput"
/>
<script :type={ColocatedHook} name=".EmojiInput">
import { createPopup } from "@picmo/popup-picker";
export default {
mounted() {
const input = this.el;
const picker = createPopup(
//...
Console error:
unknown hook found for “IdoWeb.EmojiComponents.EmojiInput”
Build directory:
_build/dev/phoenix-colocated/ido
├── IdoWeb.EmojiComponents
│ └── 20_stqqlse4fjjmkwaxmhvwqdkgdu.js
Thanks!
Most Liked
steffend
Phoenix Core Team
You need to ensure that:
- You’re importing the colocated hooks in your app.js
import {hooks as colocatedHooks} from "phoenix-colocated/dayzee"
- When you’re building for production `mix compile` needs to run before `mix assets.deploy`
Try to read the `20_stqqlse4fjjmkwaxmhvwqdkgdu.js` file you’ve shown in your output. You should see the hook name in that file.
1
Popular in Questions
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database.
Dep...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
I have a list say
x = ["23gh", "56kh", "97mh"]
I would like to pass each element to Val in each iteration.
Say, in iteration 1 -------...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size?
Thanks
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Other popular topics
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode.
The solution seems to be, in a hyphena...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New







