-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Externalise useResolvedElement #101
Comments
Hey there! I appreciate that! 🙏 It did cross my mind, but as small a task that may seem I think it won't happen in the near future, especially considering other higher-priority tasks. Honestly it's just not a complexity I'd be looking forward to with the very limited time I have all things considered. 😅 Where and how would you use it? |
That's fair! I have a couple hooks locally - some of them being replaced by |
Oh also, I believe |
Can you elaborate on that a bit? |
@ZeeCoder I created a sandbox where the issue exists. When you click the button you should see a yellow box appearing and it should move right after being painted. Additionally if you see the console log, you should also see values The problem, I believe, is that |
ooh so it's really about the first observation, right at mount. I'm in Portugal on a company trip rn, but I'll try to take a look as soon as I can next week. 👍 Thanks for the repro, efforts like these really make all the difference. |
What a coincidence. That's where I'm living now.
Thanks! I wanted to open a PR but I have no idea how to test this behavior. I tried googling for a little bit and was unsuccessful, I might see if react has any interesting test about this behavior. |
Do you know any good down to earth restaurants in Lisbon? XD
…On Mon, 20 Feb 2023, 21:38 Bruno Pinto, ***@***.***> wrote:
I'm in Portugal on a company trip rn, but I'll try to take a look as soon
as I can next week. 👍
What a coincidence. That's where I'm living now.
Thanks for the repro, efforts like these really make all the difference.
Thanks! I wanted to open a PR but I have no idea how to test this
behavior. I tried googling for a little bit and was unsuccessful, I might
see if react has any interesting test about this behavior.
—
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4CKEUWG2C2ZPKG6JBF7IDWYPP5HANCNFSM6AAAAAAU6N2DCI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sorry, I'm not able to help you in that front, but I welcome recommendations! 😜 |
I was wondering if we could expose |
Yeah I thought of that but then I'd have increased the API surface, which now I'd have to maintain. I'm a bit torn here to be honest, while I did make this internal hook to resolve a ref easily whether it's a:
If I were to start over, I would only allow for an element option, or a ref callback, but not for a ref object. There are all sorts of complexities that come from handling it because there's no way to know if .current is still up to date or not, and it doesn't allow for lazy-mounting. Not sure if I'm making sense, just sort of dumped my thoughts. 😅 I get that a ref object is convenient, especially if you have many hooks depending on an element, as then you can go:
Basically just passing the object to each hook. Not sure if that makes sense for you? |
Hi there, thanks for this great hook. Could you eventually release
useResolvedElement
as an external library? It would be good to reuse this without copying its function code.The text was updated successfully, but these errors were encountered: