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

FIO-8270: panel component closing on logic event trigger #5676

Merged

Conversation

ZenMasterJacob20011
Copy link
Contributor

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8270

Description

What changed?

Previously, formio.js would revert back to the original component schema if a logic event action changed the hidden state of the component and any component triggered its change event. This PR replaces this behavior by allowing logic event listeners to update the original component hidden property so that it does not get reverted back when an input is made on the form.

Why have you chosen this solution?

Although there were many potential solutions, my solution was best because it allows all the tests to pass

Dependencies

N/A

How has this PR been tested?

I added automated tests and manually tested

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

Comment on lines +401 to +409
setTimeout(()=>{
textFieldComponent.refs.input[0].value = "test"
textFieldComponent.refs.input[0].dispatchEvent(new Event('input'));
setTimeout(()=>{
assert.equal(panelComponent.component.hidden, false);
assert.equal(panelComponent.visible, true);
done();
},400);
},200);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not fond of this pattern. We should discuss a better pattern for these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it that we have two sources of truth to check if a component is visible or not?

@johnformio johnformio merged commit 47de204 into master Jul 11, 2024
5 checks passed
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.

2 participants