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

Move output ports to edges level #12133

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from
Open

Conversation

vitvakatu
Copy link
Contributor

Pull Request Description

Fixes #11922

ports-on-edges-layer.mp4
copy-error-button-works.mp4

Important Notes

See #12131 and #12132.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

Copy link

github-actions bot commented Jan 24, 2025

🧪 Storybook is successfully deployed!

📊 Dashboard:

@vitvakatu
Copy link
Contributor Author

vitvakatu commented Jan 27, 2025

Oops, not exactly what I wanted, sorry for ping.

Comment on lines 466 to 471
onBlur(() => {
graph.setNodeHovered(nodeId.value, false)
updateNodeHover(undefined)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it this component's blur or window/document blur? I think it should be the latter, but the name does not say it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to onWindowBlur, you are right.

@@ -464,8 +478,8 @@ const showMenuAt = ref<{ x: number; y: number }>()
:class="nodeClass"
:data-node-id="nodeId"
@pointerdown.stop
@pointerenter="((nodeHovered = true), updateNodeHover($event))"
@pointerleave="((nodeHovered = false), updateNodeHover(undefined))"
@pointerenter="(graph.setNodeHovered(nodeId, true), updateNodeHover($event))"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps setNodeHovered should be just a part of updateNodeHover? I think I see these two always called together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updateNodeHover is used on its own once, though, on pointer move.

Comment on lines 244 to 250
watch(isVisualizationVisible, (val) => {
if (!val) {
visualizationHovered.value = false
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

It's strange this is needed; hiding visualization itself should emit "pointerleave", effectively setting visualizationHovered to false. Is this needed due to the modifiers problem? If yes, then add a comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I wasn’t paying enough attention here. We’re not getting pointerleave for whatever reason. I just added a comment about it.

Comment on lines 249 to 252
setSoleSelected: (element: T) => {
setSelection(new Set([element]))
onSoleSelected?.(element)
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these names are a bit confusing. setSoleSelected technically should be the same as setSelection with a single node. But only the former calls onSoleSelected.

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 are right, I removed setSoleSelected, onSoleSelected is now triggered if we pass a single element.

Comment on lines 141 to 154

const blurHandlers = new Set<() => void>()

/**
* Register a callback to be called when the window is blurred.
* The callback will be called when the window is blurred, and will be removed when the component is unmounted.
*/
export function onBlur(callback: () => void) {
blurHandlers.add(callback)
onUnmounted(() => {
blurHandlers.delete(callback)
})
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It's the same as useEvent(window, 'blur'), isn't it? Because useEvent also removes itself (on scope disposal, but it's effectively same as unmount).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but here we have a single event handler per application instead of multiple event handlers per node. We use the same pattern for autoBlur, for performance reasons.

Comment on lines 123 to 125
const nodeIdsWithOutputPorts = computed(() =>
Array.from(graph.db.nodeIdToNode.entries())
.filter(([_, node]) => node.type !== 'output')
.map(([id]) => id),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use graph.db.nodeOutputPorts?

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 guess no particular reason, just reused the code from some other place. Changed it now as suggested.

@vitvakatu vitvakatu force-pushed the wip/vitvakatu/copy-error branch from a61697e to 281f86f Compare January 29, 2025 22:00
@vitvakatu vitvakatu requested review from kazcw and farmaazon January 30, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy button on error messages not working
3 participants