-
Notifications
You must be signed in to change notification settings - Fork 29
Allow to paste position or link anywhere #8652
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
Conversation
📝 WalkthroughWalkthroughThe changes add a global paste event handler to the viewer layout, enabling users to paste dataset positions or URL hashes directly into the page. The URL parsing logic is refactored to support this, allowing flexible input of position data via clipboard without focusing input fields. The changelog is updated accordingly. Changes
Assessment against linked issues
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/javascripts/viewer/view/layouting/tracing_layout_view.tsx (1)
267-297
: Well-implemented paste handler with good UX considerations.The implementation correctly handles both URL hash strings and position coordinates while preserving normal paste behavior in form fields. The code properly checks edge cases and prevents default paste behavior only when necessary.
// Suggestion for minor type safety improvement const numbers = pastedText.split(",").map(Number); -if (numbers.length === 3 && !numbers.some(isNaN)) { - applyState({ position: numbers as Vector3 }); +if (numbers.length === 3 && !numbers.some(isNaN)) { + const position: Vector3 = [numbers[0], numbers[1], numbers[2]]; + applyState({ position });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.unreleased.md
(1 hunks)frontend/javascripts/viewer/controller/url_manager.ts
(1 hunks)frontend/javascripts/viewer/view/layouting/tracing_layout_view.tsx
(4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/javascripts/viewer/view/layouting/tracing_layout_view.tsx (3)
frontend/javascripts/libs/window.ts (1)
document
(19-34)frontend/javascripts/viewer/model_initialization.ts (1)
applyState
(764-790)frontend/javascripts/viewer/constants.ts (1)
Vector3
(13-13)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build-smoketest-push
- GitHub Check: backend-tests
🔇 Additional comments (5)
frontend/javascripts/viewer/controller/url_manager.ts (2)
163-170
: Clean refactoring to support external hash updates.The changes to
onHashChange
and the newupdateToHash
method create a cleaner separation of concerns and allow external components to trigger hash updates directly.
172-174
: Good improvement to parseUrlHash flexibility.Modifying
parseUrlHash
to accept an optional hash parameter makes the function more versatile without breaking existing functionality. The nullish coalescing operator is used appropriately to maintain backward compatibility.CHANGELOG.unreleased.md (1)
20-20
: Thorough and clear documentation of the new feature.The changelog entry effectively communicates the new feature's functionality, limitations, and usage instructions. It provides good examples and explains the behavior clearly.
frontend/javascripts/viewer/view/layouting/tracing_layout_view.tsx (2)
118-118
: Event listener properly registered.The paste event listener is correctly registered at the document level to capture paste events anywhere in the application.
122-122
: Proper cleanup of event listener.The paste event listener is correctly removed during component unmount, which prevents memory leaks and unintended behavior.
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.
LGTM. Works well
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
(Please delete unneeded items, merge only when none are left open)