-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix(useMeasure): let ref accept null value #1267
Conversation
}); | ||
|
||
expect(observe).not.toHaveBeenCalled(); | ||
}) |
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.
New test to make sure ref
accepts null
and that useMeasure
doesn't try to observe a null
element.
@streamich Hi can we get this merged? |
|
||
it('by default, state defaults every value to -1', () => { | ||
it('by default, state defaults every value to 0', () => { |
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.
Left over from an old revert of the hooks' behaviour.
const { result } = renderHook(() => useMeasure()); | ||
|
||
act(() => { | ||
const div = document.createElement('div'); | ||
(result.current[0] as UseMeasureRef)(div); | ||
result.current[0](div); |
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.
Type is properly inferred by TS.
Description
Fix #1264
Strangely, the Storybook story wasn't showing the error. I'm not sure why 🤷♂️
Type of change
Checklist
Add documentationAdd hook's story at Storybookyarn test
)yarn lint
). Fix it withyarn lint:fix
in case of failure.yarn lint:types
).