[WIKI-506] fix: close the link view after 300ms of hovering out#7283
[WIKI-506] fix: close the link view after 300ms of hovering out#7283sriramveeraghanta merged 1 commit intopreviewfrom
Conversation
WalkthroughThis update enhances the link preview feature in the editor by introducing delayed closing logic. Mouse event handlers and a timeout mechanism are implemented to keep the link preview open briefly after the mouse leaves, and to cancel the close if the mouse returns. Cleanup is handled on component unmount. Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/editor/src/core/components/editors/link-view-container.tsx (1)
134-156: Complex but necessary logic for container mouse leave.The
handleContainerMouseLeavefunction implements sophisticated logic to prevent premature closing when the mouse moves from the container to the floating element. The logic appears correct but is complex.Consider adding a comment explaining the edge case this handles (preventing close when mouse moves from container to floating element).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/editor/src/core/components/editors/link-view-container.tsx(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
packages/editor/src/core/components/editors/link-view-container.tsx (9)
16-16: LGTM! Proper type definition for timeout reference.The
hoverTimeoutRefis correctly typed asnumber | nullto handle both the timeout ID and null states.
48-54: LGTM! Clean timeout management.The
clearHoverTimeoutfunction properly clears the timeout and resets the reference to null, preventing memory leaks.
67-67: LGTM! Good defensive programming.The null safety check for
linkExtensionStorageprevents potential runtime errors.
93-94: LGTM! Logical timeout clearing on link hover.Clearing the timeout when hovering over a link ensures the preview stays open, which aligns with the expected user experience.
119-127: LGTM! Clean floating element hover handlers.The mouse enter/leave handlers for the floating element are simple and effective - clearing timeout on enter and setting it on leave.
164-165: LGTM! Proper event listener management.The addition of
mouseenterandmouseleaveevent listeners alongside the existingmouseoverlistener properly supports the hover timeout behavior.Also applies to: 169-170
176-176: LGTM! Essential cleanup on unmount.The cleanup effect ensures any pending timeout is cleared when the component unmounts, preventing potential memory leaks.
180-180: LGTM! Consistent null safety.Another good defensive programming practice with the null safety check for
linkExtensionStorage.
188-194: LGTM! Proper integration of hover handlers.The floating div now includes the necessary mouse event handlers to complete the hover timeout behavior implementation.
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
Description
Close the link view after 400ms of hovering out!
Summary by CodeRabbit