[WC-3533]: Fix/combobox on change - #2379
Open
r0b1n wants to merge 2 commits into
Open
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull request type
Refactoring (e.g. file rename, variable rename, etc.)
Description
Previously we were calling the event defined as OnChange seprately from the attributes and associations. In the code we were calling it manually to emulate the framework behaviour because of some istorical reasons. At this moment analysis says that we can actually attach the onChange to attributes and association and make the framework handle this action automatically.
This is needed to mitigate the issue with a race condition between editing and calling actions. At the moment if association being edited is also part of the onCHange action parameters, the action (nanoflow) gets stale parameters, so when changing from Options 1 to Option 2 and then immediately calling manual onChange, the nanoflow gets Option 1, while user just changed Option 1 to Option 2.
This refactoring passes the responsibility of handing the race condition to the framework's built in functionality.
What is still broken
As I implemented this change, this revealed a possible bug in the framework where instead of stale parameter, the prameter is not passed at all. 😅 Waiting for the team to confirm if it's a bug on their side. For now one e2e test is expected to be broken.
What should be covered while testing?
Check that all existing OnChange actions are still working as expected for different types of attributes and association. This PR introduces e2e tests that cover majority of scenarios, there might be some I missed. Test pages are committed in the test project and stil lcompatible with 10.22, so you can check with old version of the widget.