Skip to content

Rename togglePatternType to setPatternType, get rid of toggled prop in RegexpToggle

Administrator requested to merge fa/setpatterntype into master

Created by: attfarhan

This PR changes the logic for toggling the regex selector in the search bar. Prior, the logic was "if we are currently searching literally and it changes, toggle the regexp button on" and "if we are currently searching in regexp and it changes, toggle the regexp button off".

Now that there is a third option to search with patterntype:structural, the previous boolean logic does not have enough information to decide whether to toggle the button based on the previous state. This means that in the current behavior, if we switch from literal to structural, the toggle would be turned on (which we don't want).

This PR changes the state of the toggle button to be based on the current patterntype, where patterntype = structural implies that the toggle is off.

Merge request reports

Loading