Closed stramel closed 3 years ago
@stramel is attempting to deploy a commit to the HappyKit Team on Vercel.
A member of the Team first needs to authorize it.
Wow, that's pretty neat! I wasn't aware of this API.
I looked into swr
and it seems like they're doing it that way as well.
I'm currently working on the next iteration of @happykit/flags
which will be out in a few days, and which is a complete rewrite. Your suggestion will make it into the rewrite. I don't want to release an update to the current version to avoid having to make people upgrade twice within a few days. So unfortunately I can't merge this PR but the approach will make it in!
In case you're curious, you can check out the rewrite under the next
branch. There's an example
folder there which is a Next.js application that uses the unpublished new client from the package
folder.
Thanks again, seeing your contribution made me really happy :)
Your suggestion has made it into next
now: https://github.com/happykit/flags/commit/30c9038cf9afa1b48b17cd422cca94ea92158167
Thanks again!
Hello 👋, I was looking into
@happykit/flags
implementation for therevalidateOnFocus
I noticed that it utilizeswindow.addEventListener('focus', ...)
for handling the focus. I found a few issues with this implementation:iframe
can cause the focus event to fire numerous times if the user interacts with theiframe
and then back with the current documentfocus
event to fire numerous times if the user/developer interacts with the DevTools and then back with the document. (A very common case for developers)node.dispatchEvent(new CustomEvent('focus', { bubbles: true}))
). This case seems less likely but still a side-effect of the current implementation.I'm curious if you have considered utilizing the Page Visibility API to achieve a more true implementation for "refocus" of the window.
Thank you for taking the time to consider my suggestion!