Comments (8)
Hi @miguel-s!
Ideally, it shouldn't be necessary to pass it manually. The :__surface__
assign belongs to the private API. I'll create a test for this case so we can work on a proper solution.
Cheers.
from surface.
To clarify, this isn't blocking. Since the target changes in live view, you can work around this easily by creating a handle_event/3
in your modal component, and then targeting that component with a phx-click
& phx-target
on your button.
def handle_event("open", _data, socket) do
{:noreply, assign(socket, open: true)}
end
from surface.
Hi @cadebward!
I was able to reproduce it. I'll push a fix for it soon.
Thanks for the report.
from surface.
Actually I can't reproduce it :)
I found another edge case which is when the content of the dialog is empty but that raise another error. What changes should I make in the Dialog
demo to raise the same error?
Is the demo not working at all in your tests? Does it work if you use this branch? https://github.com/msaraiva/surface/tree/ms-context-api
from surface.
Just to clarify, the PR is ready to go. As soon as I update the examples, I'll merge it.
In case you're using contexts, you need to adjust your code to the new API, i.e, you need to declare when using context.
Example for the Form component:
...
property change, :event
context set form, :form
def init_context(assigns) do
opts = [phx_change: assigns.change.name, autocomplete: assigns.autocomplete]
form = form_for(assigns.for, "#", opts)
{:ok, form: form}
end
...
Example for the Field component:
context set field, :atom, scope: :only_children
context get form, from: Form
def init_context(assigns) do
{:ok, field: String.to_atom(assigns.field)}
end
and finally, Textinput:
context get form, from: Form
context get field, from: Field
Note:
end_context/1
is no longer required.
from surface.
Hmm... I wonder if my problem was that I had a custom update/2
function? I'll go ahead and close this since it was easy to work around and you aren't able to reproduce. Thanks for the update.
from surface.
Hi @msaraiva @cadebward!
I'm running into the same issue with send_update
. It seems to only occur when I use a custom update/2
function, just as @cadebward suspected.
I found workaround by passing the :__surface__
assign in the send_update
function.
from surface.
Hi @msaraiva!
Just want to confirm that #114 fixed this issue for me.
I was still using the v0.1.0-alpha.2 release, but recently upgraded to the master branch.
Thanks!
from surface.
Related Issues (20)
- How to define a variable inline in Surface templates? HOT 1
- Elixir 1.15.0 app startup error HOT 5
- Bogus "undefined assign `@streams`." warning HOT 2
- Since update : no route found for POST after a <Form> is submitted HOT 1
- Improve error messaging when using `<#slot />` in template via `embed_sface/1` macro
- Setting which modules can pass context values outside of config
- Erlang Error in Elixir Language Server with Surface HOT 1
- [Using a plugin] Scoped CSS changes require two page reloads. HOT 1
- inputs_for/3 warning HOT 1
- Warnings on Select component with disabled property
- Props missing inside `handle_event()` `socket.assigns` map. HOT 3
- mix surface.init: no function clause matching in Sourceror.Zipper.down/1 HOT 3
- Support for LiveViewNative? HOT 5
- Submitted forms don't carry the "submitter" attribute
- Surface CSS scoping attributes don't work when root component is a component
- When using :on-click={"name", target="#target_id"} I cannot seem to get a sibling to target another sibling node that is rendered in the same parent. HOT 1
- Compatibility with LiveView 0.20 HOT 7
- Question: How would you make the sample tab component to use svg icons instead of font icons HOT 4
- Elixir 1.16: negative steps are not supported in String.slice/2, pass 1..-2//1 instead
- Malformed HTML when using LiveRedirect with another component inside HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from surface.