Dylan-aidkr
(Solved) Surface live component slot arg create weird dialyzer pattern_match error
While changing some live component to surface live component,
Dialyzer gave an error like below:
lib/~some_path~/index.sface:1:pattern_match
The pattern can never match the type.
Pattern:
false
Type:
true
As it shows no useful line number, and there was no error when compiling and running the code, I had to find it by commenting out binary search the source code.
Below is part of the index code where it used live component before changing to surface:
<live_component module={SomeModule} id="some-id" data={@some_data} :let={prop}>
<button phx-click={prop.on_click} >button</button>
</.live_component>
After changing to surface live component:
<SomeModule id="some-id" data={@some_data} :let={prop}>
<button phx-click={prop.on_click} >button</button>
</SomeModule>
The problem was getting slot argument as whole prop variable.
I don’t know why it broke Dialyzer, and there was no error from Surface.
But after changing to the following, Dialyzer error disappeared:
<SomeModule id="some-id" data={@some_data} :let={on_click: on_click}>
<button phx-click={on_click} >button</button>
</SomeModule>
I couldn’t make a reproducible example,
so I’m leaving this note just in case anyone stumbles upon a similar problem.
Popular in Questions
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Other popular topics
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
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







