Skip to content

search: Refactor onboarding tour <-> query input interaction

Administrator requested to merge fkling/refactor-onboarding-tour into main

Created by: fkling

This PR refactors how the search onboarding tour (and other code) interacts with the query state. In particular it changes how the tour triggers query input suggestions. I'm making this change to standardize on one solution for triggering suggestions.

Until now the tour used a direct reference to the query input to trigger suggestions. It would inspect the current query on every change and decide whether or not to trigger suggestions.

Since the tour was added we made changes to the query state that allows code to inform the query input to show suggestions. It was only used by the search sidebar so far.

Instead of introducing yet another change type, I'm only distinguishing between user changes and "other" changes. "Other" changes can specify a couple of optional fields, including whether or not the query input should show suggestions after a change. Another important change is that the editor will always receive focus when the suggestions are shown (edit: apparently Monaco does this automatically when showing suggestions, but not CodeMirror)

This way the tour can simply set that flag when it updates the query and doesn't have to implement it's own logic to determine whether or not it should trigger suggestions.

Test plan

Integration tests pass. I added two more tests that verify the query input behavior via the search sidebar.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading