-
Notifications
You must be signed in to change notification settings - Fork 21
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(components): new component to wrap components so a display event is emitted when they appear in the viewport for the first time #1391
Conversation
… is emitted when they appear in the viewport for the first time
const { isElementVisible, unwatchDisplay } = useOnDisplay({ | ||
element, | ||
callback: callbackSpy, | ||
...(!triggerOnce && { triggerOnce }) |
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.
...(!triggerOnce && { triggerOnce }) | |
triggerOnce |
what am I missing here? why do all that?😅
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 If I send null
it doesn't send anything to the method, which doesn't make sense because I have true
by default, so I'm actually not testing if the composable sets triggerOnce = true
by default because I was doing it manually in this function.
…is-visible # Conflicts: # packages/x-adapter-platform/src/mappers/responses/__tests__/__snapshots__/search-response.mapper.spec.ts.snap
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.
The open source community was waiting this for a long time, great job!
EMP-3241
Motivation and context
We needed a way of emitting a display event when a specific component appeared in the viewport. This PR adds a new component that will do that with any component that is passed as slot.
Type of change
What is the destination branch of this PR?
Main
How has this been tested?
The query previews in the
home
component are wrapped by the new component. Test it by checking if a display event is emitted when they appear in the viewport.