Repository navigation
fix: selection box updating on dragging - #5046
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
| const getSelectionBox = (cellId: string) => | ||
| selection['selectionImpl']['container'].querySelector( | ||
| `[data-cell-id="${cellId}"]`, | ||
| ) as HTMLElement |
There was a problem hiding this comment.
为了提高测试的健壮性和错误信息的可读性,在 querySelector 之后检查元素是否存在是一个好习惯。这可以避免下游代码出现潜在的 null 引用错误,并在找不到选框时提供更具体的错误信息。
const getSelectionBox = (cellId: string) => {
const box = selection['selectionImpl']['container'].querySelector<HTMLElement>(
`[data-cell-id="${cellId}"]`,
);
if (!box) {
throw new Error(`Selection box for cell '${cellId}' not found.`);
}
return box;
}
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5046 +/- ##
==========================================
+ Coverage 83.46% 83.54% +0.07%
==========================================
Files 332 332
Lines 38535 38588 +53
Branches 7921 7942 +21
==========================================
+ Hits 32163 32238 +75
+ Misses 6349 6327 -22
Partials 23 23
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
📝 Description
在拖拽框选节点时,selection box 随节点、边的变化实时更新。
🖼️ Screenshot
💡 Motivation and Context
🧩 Types of changes
🔍 Self Check before Merge