Skip to content
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

fix: improve performance of connecting blocks #6876

Merged
merged 11 commits into from
Mar 16, 2023
9 changes: 2 additions & 7 deletions core/insertion_marker_manager.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectionType is now unused, and you missed the lint warning (but now we can all enjoy it! 🤣)

Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,14 @@ export class InsertionMarkerManager {
*/
applyConnections() {
if (!this.activeCandidate) return;
// Don't fire events for insertion markers.
const {local, closest} = this.activeCandidate;
local.connect(closest);
BeksOmega marked this conversation as resolved.
Show resolved Hide resolved
eventUtils.disable();
this.hidePreview();
eventUtils.enable();
const {local, closest} = this.activeCandidate;
// Connect two blocks together.
local.connect(closest);
if (this.topBlock.rendered) {
// Trigger a connection animation.
// Determine which connection is inferior (lower in the source stack).
const inferiorConnection = local.isSuperior() ? closest : local;
blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock());
// Bring the just-edited stack to the front.
const rootBlock = this.topBlock.getRootBlock();
setTimeout(() => {
rootBlock.bringToFront();
Expand Down