- 
                Notifications
    You must be signed in to change notification settings 
- Fork 17
volatile data can also be null #286
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           @@
##              6.x     #286   +/-   ##
=======================================
  Coverage   80.27%   80.27%           
=======================================
  Files          19       19           
  Lines        2023     2023           
=======================================
  Hits         1624     1624           
  Misses        399      399
 Continue to review full report at Codecov. 
 | 
| } | ||
| this.on(response.result.channel, data => { | ||
| data.fromSelf = data.volatile !== undefined && data.volatile.sdkInstanceId === this.id; | ||
| data.fromSelf = data.volatile !== undefined && data.volatile !== null && data.volatile.sdkInstanceId === this.id; | 
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 there any chance data.volatile  can be a scalar?
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.
No, the RequestInput object forbids it: https://github.com/kuzzleio/kuzzle-common-objects/blob/master/lib/models/requestInput.js#L249
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.
ok, great
| } | ||
| this.on(response.result.channel, data => { | ||
| data.fromSelf = data.volatile !== undefined && data.volatile.sdkInstanceId === this.id; | ||
| data.fromSelf = data.volatile !== undefined && data.volatile !== null && data.volatile.sdkInstanceId === this.id; | 
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.
ok, great
* index controller * server controller * collection controller * document controller * wip * wip * wip - http * rc - wo tests * fix vars scope * tests - collection * tests ms * nitpicking * re-add package-lock.json (previously removed by error by #286) * ServerController: add jsdocs * ServerController: add getStats method * fix request.refresh argument * inject kuzzle's volatile into requests * remove defaultIndex * remove obsolete unit tests on removed features * unit-tests on security objects * Refactor unit-tests for network protocols and query management * refactor unit-tests for Kuzzle constructor, getters and setters * fix kuzzle.connect unit tests * fix unit tests for kuzzle eventEmitter/listener management * fix unit tests for Kuzze netowrk methods * fix unit tests for kuzzle query management * fix linter * fix unit-test for memoryStorage controller * fix unit tests for auth controller * remove obsolete mock * fix unit test for bulk controller * fix unit-test for collection controller * improve naming for unit test groups * unit-tests for server controller * typo * unit tests for document controller * unit tests for index controller * factorize security objects contructors * nitpicking * add unit tests for security controller * add unit tests for DocumentSearchResult class * add unit tests for SpecificationsSearchResult class * add hits array to searchResult objects * add unit tests for ProfileSearchResult class * add unit tests for UserSearchResult class * add unit tests for RoleSearchResult class * add unit tests for RealTime controller and Room class * harmonize error rejections (use throw instead of Promise.reject)
When looking if a
sdkInstanceidentifier is present in volatile data, we first check whether volatiles are defined or not. But they can also be null, leading to a sdk crash when that happens.This PR fixes that issue.