-
Notifications
You must be signed in to change notification settings - Fork 32
Expressions: Returning null
when component
is hidden
#635
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…is hidden when looking up a component
…iddenFields first (just like in real code)
# Conflicts: # src/altinn-app-frontend/src/features/expressions/shared.test.ts
…k up the component ID in the collection of root nodes - merely using the currentLayout as a suggestion on where to look first.
…ges. It all came to a halt when I found that even resolvedLayoutsFromState() only resolves from the context of the current layout, so a bigger change is needed to make this work.
…caused an infinite loop in useExpressions.test.tsx
… makes multi-page component lookups work properly.
… sure to re-run expressions after that to catch potential dependencies.
… In the test-code, the hidden property was placed on the wrong level in the tree.
5 tasks
…rcepted by the last intercept call when it reloaded
# Conflicts: # test/cypress/e2e/integration/app-frontend/group.js # test/cypress/e2e/support/app-frontend.js # test/cypress/e2e/support/index.d.ts
…rcept above only triggers once.
Kudos, SonarCloud Quality Gate passed! |
bjosttveit
approved these changes
Nov 15, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🥇
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/test
related to automated and functional testing
kind/product-feature
Pull requests containing new features
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In the
component
lookup function, the returned value should benull
if the component itself is hidden.The reason this PR is so large for such a minor feature, is mostly because of the way expressions were resolved - they did not have all layouts (in a layout set) available at all times, so some code had to be refactored to make sure of that. Also, this leads to some complexity when factoring in that hiding an entire layout should hide all components within it - and hiding such a component by hiding the entire layout should make the
component
lookup return null even if the component has a data model value. The added cypress test reflects one of the more complex use-cases this solves.Related Issue(s)
not
function, extend logic behindcomponent
#630Verification
Documentation
[ ] User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)