Skip to content

Making sure that empty branch inputs produce empty branch outputs#748

Draft
adecler wants to merge 1 commit intodevelopfrom
Grasshopper_UI-#701-EmptyBranchInputs
Draft

Making sure that empty branch inputs produce empty branch outputs#748
adecler wants to merge 1 commit intodevelopfrom
Grasshopper_UI-#701-EmptyBranchInputs

Conversation

@adecler
Copy link
Copy Markdown
Member

@adecler adecler commented May 4, 2026

Issues addressed by this PR

Closes #701

This creates the behaviour requested in the issue.

That being said, I am not a big fan of this PR for a few reasons:

  • The code needed to get this behaviour doesn't fell great. We're effectively having to access each input three times (once in SolveInstance, once when actually executing the component, and once in AfterSolveInstance. The code also has a set of guardrails to make sure that behaviour is only occurring when for that specific scenario but it would be easy to miss another edge-case where it is now happening but is not desired. I am not fluent enough in complex GH workflow to tell.
  • This fix is specific to single-item inputs (i.e. each item is producing an output vs objects with lists as property). Changing the behaviour for this case raises questions on the expected behaviour for list and tree inputs. For example, an empty branch is treated as an empty list and therefore produces an output if the component was expecting a list for that input. That doesn't align completely with the change we're making here and could confuse the user in other ways.
  • There a lot of lacing situations that are not covered here that could be problematic. For example, what if all inputs have values for the same corresponding branch but a single input has that branch empty? Does the use expect to still produce an object? If yes, which what value for that input? Null? Default value? We're just opening the door to more confusing rules.

So, in summary, it feels that this PR is creating more problems than it is solving. It feels it would be preferable for everyone to have simple expected behaviour on BHoM components and, in exchange, ask users to keep their script clean. But I am not a GH expect so maybe I am missing something?

@michaelhoehn , I would appreciate your opinion on this one.

Test files

See issue

Changelog

Additional comments

@adecler adecler requested a review from michaelhoehn May 4, 2026 15:13
@adecler adecler self-assigned this May 4, 2026
@adecler adecler added status:do-not-merge For instance, test PR, for discussion, or dependant PRs not ready for merge type:bug Error or unexpected behaviour labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:do-not-merge For instance, test PR, for discussion, or dependant PRs not ready for merge type:bug Error or unexpected behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty lists get turned into nulls on object creation

1 participant