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

Components with complex conditions create a variable with null name in getSchemaVariables #860

Closed
christian-konrad opened this issue Oct 21, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@christian-konrad
Copy link
Contributor

christian-konrad commented Oct 21, 2023

Describe the Bug

Components with complex conditions create a variable with null name in getSchemaVariables.
The conditions must use a context in order to cause that behavior, like

{
  remainingAllowance: loanOptions.maxAllowance - loanOptions.currentlyUsed,
  restAfterNewLoan: remainingAllowance - offeredAdditionalLoan
}.restAfterNewLoan < 0

Steps to Reproduce

  1. Add a component
  2. Add a complex condition that utilizes a context
  3. Use it in Tasklist - it will break variables/search as getSchemaVariables outputs a variable with name null
image image

image

Expected Behavior

  • A group with empty path does not create a nullentry in getSchemaVariables
  • The list is sanitized by removing all null values
  • Ideally, backend also ignores nulls

Environment

Form Editor in Web Modeler SaaS as of Oct 21 2023

@christian-konrad christian-konrad added the bug Something isn't working label Oct 21, 2023
@christian-konrad christian-konrad changed the title Groups with empty paths create a variable with null name in getSchemaVariables Groups with conditions create a variable with null name in getSchemaVariables Oct 21, 2023
@christian-konrad christian-konrad changed the title Groups with conditions create a variable with null name in getSchemaVariables Groups with complex conditions create a variable with null name in getSchemaVariables Oct 21, 2023
@christian-konrad christian-konrad changed the title Groups with complex conditions create a variable with null name in getSchemaVariables Elements with complex conditions create a variable with null name in getSchemaVariables Oct 21, 2023
@christian-konrad christian-konrad changed the title Elements with complex conditions create a variable with null name in getSchemaVariables Components with complex conditions create a variable with null name in getSchemaVariables Oct 21, 2023
@pinussilvestrus
Copy link
Contributor

In form-js we filter for null values in the getSchemaVariables: https://github.com/bpmn-io/form-js/blob/develop/packages/form-js-viewer/src/util/index.js#L179

We added that filter because we had a similar error in the past. It could be that we do this check too early though.

@Skaiir
Copy link
Contributor

Skaiir commented Oct 22, 2023

Issue is a few things.

First, my safeguard against null variables doesn't work because if (not null or not undef) is the same thing as if(true) (whoopsie).

Secondly, the null arises from the fact that we have this whole complex object structure stuff going on. Basically, {}.something is being treated as unnamed.something. The unnamed becomes null down the line. We should filter those out.

Additionally we don't parse the internal scope of the object properly. This isn't a bug right now but will become one if we ever use a complex condition like that which doesn't rely on variables bound to keys.

So yeah, I'll fix things. Fixing the null situation is pretty trivial but I'll try and go for a full solution.

@pinussilvestrus pinussilvestrus added the ready Ready to be worked on label Oct 23, 2023
Skaiir added a commit that referenced this issue Oct 23, 2023
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed ready Ready to be worked on labels Oct 23, 2023
Skaiir added a commit that referenced this issue Oct 23, 2023
Skaiir added a commit that referenced this issue Oct 23, 2023
@Skaiir Skaiir closed this as completed Oct 23, 2023
@bpmn-io-tasks bpmn-io-tasks bot removed the in progress Currently worked on label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants