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

fix(CanvasForm): Expression field shows [object Object] #1077

Merged
merged 1 commit into from
May 13, 2024

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented May 13, 2024

Context

When a new expression-aware step is generated, the expression property is created as follows:

        setHeader:
          id: setHeader-1234
          expression:
            simple:
              expression: {}

Notice the expression: {} bit which causes for the expression TextField to render [object Object]

Changes

Replace the autogenerated step with an empty simple: {}, so there's the feedback that a property is left to be configured. In the future, there will be the same feedback in the Canvas as well. #705

        setHeader:
          id: setHeader-1234
          expression:
            simple: {}

Note

This comes from this PR #1068, in which I suggested using expression: {} for the newly created step.

fix: #1076

@apupier
Copy link
Member

apupier commented May 13, 2024

if I understand well, for the setBody, when inserting the element, it is setting the body to empty string ad there won't be any message to tell user to configure the field.
It sounds better to not have any values in this case. Because I fear that a lot of users will forget to modify it and will not understand why the body is "lost".

When a new expression-aware step is generated, the expression property is created as follows:

```yaml
        setHeader:
          id: setHeader-1234
          expression:
            simple:
              expression: {}
```

Notice the `expression: {}` bit which causes for the expression TextField to render `[object Object]`

The fix is to remove the `expression: {}` section and leave the `simple: {}` one, this way, in the Source Code editor, the user will get feedback that something is still pending to configure.

fix: KaotoIO#1076
@lordrip lordrip force-pushed the fix/expression-wrong-label branch from 8e8074e to 911d90f Compare May 13, 2024 10:30
@lordrip
Copy link
Member Author

lordrip commented May 13, 2024

if I understand well, for the setBody, when inserting the element, it is setting the body to empty string ad there won't be any message to tell user to configure the field. It sounds better to not have any values in this case. Because I fear that a lot of users will forget to modify it and will not understand why the body is "lost".

Updated

@lhein
Copy link
Contributor

lhein commented May 13, 2024

Although we did not yet implement any check if the expression is filled, the behavior now is that just simple is selected and the expression is empty. This will make it easier to spot the missing bit once we have the validation ready.

@lordrip lordrip merged commit ddc4142 into KaotoIO:main May 13, 2024
8 checks passed
@lordrip lordrip deleted the fix/expression-wrong-label branch May 13, 2024 11:24
@apupier
Copy link
Member

apupier commented May 13, 2024

current behavior is that:

  • when opening textual file, there is a validation error spotted
  • when running, for instance with setBody, the body is set null at runtime.

Slightly better than empty string but still not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expression contains by default [object Object]
3 participants