-
-
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
Allow bypassing the observer #42
Conversation
@@ -103,14 +103,10 @@ function useResizeObserver<T>( | |||
} | |||
} | |||
}); | |||
}, []); | |||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the dependency array is necessary, in case ref
is passed as null, then later passed as a valid value. This should not affect performance though, because the effect bails once the observer is created.
ce6cf92
to
80331d4
Compare
I've added a test to assert that a |
80331d4
to
99646c6
Compare
Is there anything I can do the help get this PR merged? |
Sorry I just don't have time to review things right now.
Maybe sometime next week.
…On Mon, 27 Jul 2020, 23:40 Jonathan Felchlin, ***@***.***> wrote:
Is there anything I can do the help get this PR merged?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4CKEXDWTKSGWZCEHWBNUTR5XX4XANCNFSM4PEED3IQ>
.
|
@ZeeCoder I don't mean to be a pest, but is there any chance you might have some time to look at this PR any time soon? |
There are a couple issues with the proposed code changes here:
I've created a new PR based on your needs. Essentially the hook would consider "null" as a special ref param, which would signal for the hook that you might pass a real ref in later for observation, but for the time being you don't need it, and so a ResizeObserver instance would not be necessary either until then. |
...by not passing a ref option.
Putting up this PR early for feedback. Tests are still needed.
I would like to use use-resize-observer, without adding the polyfill. This change makes that possible by not initializing the observer, if no
ref
is passed.