-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: usePresenceSwitch
cleanup
#1
Conversation
getByTestId('none'); | ||
getByText('Nothing mounted'); | ||
rerender(<Expander text="initial value" />); | ||
getByTestId('isAnimating, isEntering, isMounted'); | ||
getByText('initial value'); | ||
await waitFor(() => getByTestId('isVisible, isMounted')); | ||
rerender(<Expander text={null} />); | ||
rerender(<Expander text={undefined} />); |
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.
I originally did this but the tests complained in a warning and told me to use null
mountedItem | ||
}; | ||
} | ||
|
||
function isNil<ItemType>(value: ItemType) { | ||
return value == null; | ||
function isUndefined<ItemType>(value: ItemType) { |
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.
So I'm fine with this, but at this point, I feel like I lean towards just using item === undefined
or item !== undefined
in places rather than having the extra function 😅
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.
Sounds good!
So feel free to merge this as you please, I just added a couple "food for thought" comments but it's nothing that affects the usability of the feature for me! |
Hey, here are some changes I'd propose to simplify and clean up the README a bit.
I'd also reduce the API surface to not handle
null
in a special way, maybe there's a use case where this is expected to be an actual value.Let me know if this works for you!