Skip to content

Conversation

Yoann-Abbes
Copy link
Contributor

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?

  • Step 1 :
  • Step 2 :
  • Step 3 :
    ...

Other changes

Boyscout

@codecov
Copy link

codecov bot commented Nov 14, 2019

Codecov Report

Merging #464 into 7-dev will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/controllers/index.js 100% <100%> (ø) ⬆️
src/Kuzzle.js 94.46% <100%> (ø) ⬆️
src/controllers/collection.js 100% <100%> (ø) ⬆️
src/controllers/document.js 95.08% <100%> (-0.92%) ⬇️
src/controllers/security/index.js 99.2% <100%> (-0.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 961548b...31a3002. Read the comment docs.

@Yoann-Abbes Yoann-Abbes changed the title Fixes option refresh in queries Fix option refresh in queries Nov 14, 2019
action: 'create',
refresh: options.refresh
};
delete options.refresh;
Copy link
Contributor

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.

Copy link
Contributor Author

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

index: 'index',
collection: 'collection'
collection: 'collection',
refresh: undefined
Copy link
Contributor

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;
Copy link
Contributor

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 

@Aschen Aschen merged commit c80e57f into 7-dev Nov 20, 2019
@Aschen Aschen deleted the fix-option-refresh branch November 20, 2019 16:34
@Aschen Aschen mentioned this pull request Nov 20, 2019
Aschen added a commit that referenced this pull request Nov 21, 2019
# [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))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants