Skip to content

Conversation

DrJKL
Copy link
Contributor

@DrJKL DrJKL commented Sep 22, 2025

Summary

Remove more procedural synchronization in favor of using reactive references.

Note: Also includes some fixes for issues caused during HMR.

Review Focus

In testing it seems to work the same, but let me know if I missed something.

┆Issue is synchronized with this Notion page by Unito

@DrJKL DrJKL marked this pull request as ready for review September 22, 2025 06:48
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 22, 2025
@DrJKL
Copy link
Contributor Author

DrJKL commented Sep 22, 2025

The function expression → declaration change is half stylistic and half precautionary. The bug shows up when the event listener holds on to a reference that's further down in scope and gets wiped.

Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

Very nice

rafId = null
})
}
const { resume: handleTransformUpdate } = useRafFn(updateVisibility, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we expose the pause() function? We can pause when the TransformPane emits the "stopped transforming" event (or something similar).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually want to get rid of this entirely and just have the nodes react to changes in the transformPane (throttled)

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that what was happening already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, it's querying the document with every call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at it, I initially thought handleTransformUpdate was only called when a transform event is emitted by TransformPane which would then trigger an updateVisibility.

I thought resume from useRafFn essentially started calling the rafFn every frame until pause is called. So now, we are resume when transform is emitted -> starting a call every frame. But before, we just called on every frame that a transform is emitted. Is that wrong?

Copy link
Contributor

@christian-byrne christian-byrne Sep 22, 2025

Choose a reason for hiding this comment

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

Well, the TransformPane is emitting update event every frame anyway, because it's using useCanvasTransformSync which just simply uses its own rafFn that runs every frame, so I'm incorrect afterall.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested by adding console.count call in handleTransformUpdate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You were right locally, but that does explain why this code didn't tank performance relative to baseline like it would have otherwise 😁

@DrJKL DrJKL force-pushed the drjkl/feat/note-node-3 branch from a4fd9b6 to 84f8aa8 Compare September 22, 2025 16:15
Copy link

github-actions bot commented Sep 22, 2025

🎭 Playwright Test Results

All tests passed!

⏰ Completed at: 09/22/2025, 07:42:46 PM UTC

📈 Summary

  • Total Tests: 460
  • Passed: 431 ✅
  • Failed: 0
  • Flaky: 0
  • Skipped: 29 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 424 / ❌ 0 / ⚠️ 0 / ⏭️ 29
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 4 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@DrJKL DrJKL force-pushed the drjkl/feat/note-node-3 branch from d6eb6d8 to 32af5a7 Compare September 22, 2025 19:21
@DrJKL DrJKL force-pushed the drjkl/feat/note-node-3 branch from 32af5a7 to b992c12 Compare September 22, 2025 19:31
@christian-byrne christian-byrne merged commit e5d4d07 into main Sep 22, 2025
25 checks passed
@christian-byrne christian-byrne deleted the drjkl/feat/note-node-3 branch September 22, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:vue-migration size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants