Skip to content

Commit 674a2d7

Browse files
committed
db: drop subscription if there are no dependencies left
1 parent fc6230c commit 674a2d7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/db/src/subscription.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,17 @@ export class GQLSub {
150150

151151
const { cbk } = this;
152152
if (cbk) {
153-
if (this.operation !== 'subscription') {
153+
if (this.operation !== 'mutation') {
154154
// drop this sub from
155-
this.off();
156-
cbk({ data: tree });
157-
} else {
155+
if (Object.keys(deps.index).length === 0) {
156+
this.off();
157+
}
158158
cbk({
159159
data: tree,
160160
off: () => this.off(),
161161
});
162+
} else {
163+
cbk({ data: tree });
162164
}
163165
}
164166
}

0 commit comments

Comments
 (0)