Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4239,6 +4239,10 @@ impl NodeNetworkInterface {
}
NodeTypePersistentMetadata::Node(_) => {}
}
// Altering an export may move the connectors meaning the ports must be refreshed.
if matches!(input_connector, InputConnector::Export(_)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This unload_import_export_ports call only covers the case where a node is being connected to an export. However, disconnecting a node from an export (the (NodeInput::Node { .. }, NodeInput::Value { .. } | ...) arm) can also change whether the first export is a layer, affecting connector positions. Consider moving this check to the end of set_input so it runs for any successful export modification, or add an equivalent check in that arm.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At editor/src/messages/portfolio/document/utility_types/network_interface.rs, line 4243:

<comment>This `unload_import_export_ports` call only covers the case where a node is being connected to an export. However, disconnecting a node from an export (the `(NodeInput::Node { .. }, NodeInput::Value { .. } | ...)` arm) can also change whether the first export is a layer, affecting connector positions. Consider moving this check to the end of `set_input` so it runs for any successful export modification, or add an equivalent check in that arm.</comment>

<file context>
@@ -4239,6 +4239,10 @@ impl NodeNetworkInterface {
 					NodeTypePersistentMetadata::Node(_) => {}
 				}
+				// Altering an export may move the connectors meaning the ports must be refreshed.
+				if matches!(input_connector, InputConnector::Export(_)) {
+					self.unload_import_export_ports(network_path)
+				}
</file context>

self.unload_import_export_ports(network_path);
}
Comment on lines +4242 to +4245

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Add a semicolon to the unload_import_export_ports call for idiomatic Rust and consistency with the rest of the codebase.

Additionally, note that disconnecting a node from an export (which is handled in the (NodeInput::Node { .. }, NodeInput::Value { .. } | ...) arm of set_input) also alters the export and can change whether the first export is a layer, which affects the connector positions. You should consider either adding a similar check to that arm or moving this check to the very end of the set_input function so it runs for any successful export modification.

				// Altering an export may move the connectors meaning the ports must be refreshed.
				if matches!(input_connector, InputConnector::Export(_)) {
					self.unload_import_export_ports(network_path);
				}

self.unload_upstream_node_click_targets(vec![*upstream_node_id], network_path);
self.unload_stack_dependents(network_path);
self.try_set_upstream_to_chain(input_connector, network_path);
Expand Down
Loading