Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

feat: evaluate expression at runtime #455

Merged
merged 15 commits into from
Feb 5, 2024

Conversation

niekvanstaveren
Copy link
Collaborator

@niekvanstaveren niekvanstaveren commented Dec 12, 2023

Adding an options to have expression evaluate at runtime:

image

When this option is set the actions will run in order, but instead of using the expression values from the layout the expressions will be evaluated just before the action is run. This means that previous actions can impact the state for the next actions.

@niekvanstaveren niekvanstaveren marked this pull request as ready for review February 1, 2024 15:28
@niekvanstaveren niekvanstaveren requested a review from a team as a code owner February 1, 2024 15:28
const properties = await model.getProperties();
for (let i = 0; i < actionCallList.length; i++) {
const overrideValue =
properties.actions[i].value?.qStringExpression?.qExpr &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no idea what actionCallList does but, do note that overrideValue can become any falsy value. For example if qExpr === '', overrideValue becomes an empty string.

Same for overrideVariable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is actions a required property on properties?

Copy link
Collaborator

@cbt1 cbt1 Feb 2, 2024

Choose a reason for hiding this comment

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

And does it always match the length of actionCallList?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is a couple of questions. In order:

  1. ActionCallList is the list of actions that need to run. Actions from actions get pushed into this array if they are found. Good catch. I'll look at that
  2. Yes it is.
  3. It does not have to match actually. Since we first try to find the actions from a list the actionCallList might be shorter than actions. This could happen if you create the button through the api. It also makes sure it is backwards compatible. Most important though is probably conversion from the old button. There are some actions that we do not support in the new if I remember correct

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed based on suggestion from Max. Also made sure that the actionCallList and actions list have the same length

Copy link
Collaborator

@haxxmaxx haxxmaxx left a comment

Choose a reason for hiding this comment

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

Probably change the title and a short description

niekvanstaveren and others added 4 commits February 2, 2024 11:00
@niekvanstaveren niekvanstaveren changed the title feat(prototype): evaluate expression at runtime feat: evaluate expression at runtime Feb 2, 2024
@niekvanstaveren niekvanstaveren requested review from haxxmaxx, cbt1 and a team February 2, 2024 13:12
Copy link
Collaborator

@cbt1 cbt1 left a comment

Choose a reason for hiding this comment

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

No other comments from my side

@niekvanstaveren niekvanstaveren merged commit a20d840 into master Feb 5, 2024
5 checks passed
@niekvanstaveren niekvanstaveren deleted the dvr/sequential-expression-evaluation branch February 5, 2024 09:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants