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.
Now that we have a properly tested zealot client and an easy way to stub responses, I wrote a series of tests to lock in the behavior we expect from a user hitting "enter" in several scenarios. Once the tests were in place, I pulled out common procedures into their own functions. I'm more pleased with the API for searching within the app now. No new behavior has been added to the app here.
The parts of the app that rely on this code are:
Example
To issue a search within brim, use the
search()
function defined insrc/js/flows/search/mod.js
.The
response
can be used to setup callbacks for each ndjson payload in the response stream.The
promise
is resolved when the request finishes successfully and rejects if there is an error.The abort function is self-explanitory. It is useful if you are issuing a search within a component and need to provide a cleanup function.
The Diff
The diff may seem intimidating, but only diffing the changes to source reveals about 600 lines modified. The rest are tests and test snapshots.