-
Notifications
You must be signed in to change notification settings - Fork 49
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
remove onload #76
remove onload #76
Conversation
|
Hey is there a thread or background somewhere on this? Just curious. |
@timwis think this has mostly gone over IRC / in person. Docs might be lacking, so here's my take on why this was a good idea: It's become pretty apparent in recent months that using To make going through these hoops easier, we created packages like nanocomponent, microcomponent and cache-component. But despite this people have still been using the Hopefully this all makes sense. I truly hope that this will cause people to run into less unexpected behavior, and allow us as a community to focus on building robust, reusable components. Let me know if I missed anything, happy to answer! :D |
How often is the following really the case? 🤔
I use
It's a convenience thing to have
Cheers :D |
On my phone right now, but for 1: if a re-render happens at any point in
the tree the modal is mounted in, it will run another set of lifecycle
events and yield unexpected results.
2. The solution should be to use one of the libs I linked above, possibly
even to generate a new, reusable lib. Using on-load directly is indeed a
direct replacement, but wouldn't fix the bugs.
…On Mon, May 22, 2017, 10:53 Ben Gourley ***@***.***> wrote:
How often is the following really the case? 🤔
the same DOM node must stay on the DOM between renders. And if any DOM
node is rendered in two DOM hierarchies at the same time, it will unmount
from one of the locations - which in this case would trigger onload to fire
when it shouldn't.
I use onload/onunload a fair amount in my app for a couple of use cases:
1. Showing modals, assigning keyevents for enter esc:
<div class="modal" onload=${el => window.addEventListener('keyup',
fn)} onunload=${el => window.removeEventListener('keyup', fn)}>
2. Triggering an action that will load some content if required:
<main onload=${el => send('loadFromUrl')}>
It's a convenience thing to have onload and onunload baked in as these
_pseudo_attriubute niceties… I guess my two questions are,
1. are my use cases valid, and/or is there a better way to perform
these actions?
2. should my solution be to just import onload into my program and use
it directly?
Cheers :D
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#76 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACWletwhsWAayyiOsm5_HMXKAsH4P5heks5r8U0bgaJpZM4NgoSZ>
.
|
Ah this makes more sense to me, so if any parent of a node with
I'm just trying to understand how the bug is fixed, so no hurry on your reply! Looking at nanocomponent for reference, is it because of the unique id being assigned to the node, used in conjunction with Thx 👌 |
@bengourley I got It's kind of hard to explain |
Replaces #69 - making this part of the semver major in #74