-
Notifications
You must be signed in to change notification settings - Fork 17
Fix option refresh in queries #464
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
Conversation
Codecov Report
@@ Coverage Diff @@
## 7-dev #464 +/- ##
==========================================
- Coverage 96.01% 95.96% -0.06%
==========================================
Files 33 33
Lines 1355 1338 -17
==========================================
- Hits 1301 1284 -17
Misses 54 54
Continue to review full report at Codecov.
|
src/controllers/collection.js
Outdated
action: 'create', | ||
refresh: options.refresh | ||
}; | ||
delete options.refresh; |
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.
..why, since now Kuzzle.query handles the refresh option?
It seems to me that you don't need to change controllers to fix the issue.
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.
I changed the way it fix the issue in the last commit
test/controllers/collection.test.js
Outdated
index: 'index', | ||
collection: 'collection' | ||
collection: 'collection', | ||
refresh: undefined |
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.
Is this necessary?
src/Kuzzle.js
Outdated
if (request.refresh) { | ||
if (request.refresh || options.refresh) { | ||
if (options.refresh) { | ||
delete options.refresh; |
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.
Why do you delete the property after using it?
It can be confusing to mutate the original object, it could be reused for subsequent calls:
const options = { refresh: 'wait_for' };
sdk.query({...}, options);
sdk.query({...}, options); // options object have been mutated
# [7.0.0](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.0.0) (2019-11-20) #### Bug fixes - [ [#464](#464) ] Fix option refresh in queries ([Yoann-Abbes](https://github.com/Yoann-Abbes)) - [ [#463](#463) ] Fix erroneous error message on browser ws error ([scottinet](https://github.com/scottinet)) #### Enhancements - [ [#455](#455) ] Do not try to reconnect if the browser is offline ([scottinet](https://github.com/scottinet)) ---
What does this PR do?
This PR fixes the way we pass the
refresh
option in several routes.Before that, the option was lost and never passed to ES.
Ticket Jira
How should this be manually tested?
...
Other changes
Boyscout