Skip to content

Commit

Permalink
rename passFirst to skipFirst
Browse files Browse the repository at this point in the history
  • Loading branch information
mrspartak committed May 30, 2020
1 parent b53a79f commit 52ff696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/orm/hasura.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,23 +436,23 @@ class Hasura {
async subscribeToMore(parameters, callback, settings = {}) {
settings = __.mergeDeep(
{
passFirst: false,
skipFirst: true,
},
this.params.query,
settings,
);

callback(await this.query(parameters, settings));

let firstPassed = settings.passFirst;
let skippedFirst = !settings.skipFirst;
const subSettings = __.mergeDeep({}, this.params.subscribe, settings);
return this.subscribe(
parameters,
(response) => {
if (firstPassed === true) {
if (skippedFirst === true) {
callback(response);
} else {
firstPassed = true;
skippedFirst = true;
}
},
subSettings,
Expand Down
4 changes: 2 additions & 2 deletions tests/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ test.serial('subscribe to more works', (t) => {
});
});

test.serial('subscribe to more firstPass', (t) => {
test.serial('subscribe to more skipFirst', (t) => {
t.timeout(2000);
let events = 0;
const orm = t.context.orm;
Expand All @@ -312,7 +312,7 @@ test.serial('subscribe to more firstPass', (t) => {
if (events === 2) resolve();
},
{
passFirst: true,
skipFirst: false,
},
);
t.true(typeof unsub === 'function');
Expand Down

0 comments on commit 52ff696

Please sign in to comment.