-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive forwardTo
doesn't work exactly how I'd hoped
#14
Comments
Sorry for being thick, but I'm not sure what you mean by this. Could you explain another way? The code you posted works, yes? |
If I have a structure like: data Tree a = Tree a (Array (Tree a))
data Action = Remove | Child Int Action then I can render that with the following: view :: Tree String -> Html Action
view (Tree string subtrees) = ul # do
li # do
text string
button ! onClick (const Remove) # text "X"
li # ul ## forEachIndexed \i tree ->
forwardTo (Child i) (view tree) So, if I've got a tree like: example :: Tree String
example = Tree "Hello" [Tree "World" [], Tree "Party" [Tree "Adventure" [], Tree "Time" []]] That should render to a list like:
When "Adventure" has the |
exports.mapActions = function (parentAction, html) {
var childAction = html.props.puxParentAction;
if (childAction) console.log(childAction, html);
return React.cloneElement(html, {
puxParentAction: childAction ? parentAction(childAction) : parentAction
});
}; I put this |
If I understand you correctly, there's a bug in my FFI implementation since the type signature for The FFI implementation can be a bit cryptic, because instead of simply mapping over the actions, a reference to the action is saved on the tree for later use by |
The code looks like it should be calling parent's parent's actions. I don't know why |
Ok, here's an example project: https://github.com/parsonsmatt/pux-repro Clicking "Time" should delete "Time", but instead it deletes "World" |
Thanks for that! It helps a lot. For some reason it looks like |
Good news! This is fixed in |
Awesome, thanks! 😄 |
I'm working on a toy app with a recursive structure. Here's my action:
And an example on how I'm using it:
When the UI gets nested,
forwardTo
uses the most recent function given. It'd be nice if it composed the functions instead.The text was updated successfully, but these errors were encountered: