Skip to content

Commit

Permalink
Schopp/fix/zeroBug (#354)
Browse files Browse the repository at this point in the history
* fix(deamon): Now allowing value 0 and 0 for change events
* fix(deamon): Value 0 and null are now accepted as values for add event
  • Loading branch information
Florian-Schopp authored Jan 26, 2023
1 parent fbb27bb commit 8f36960
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/3_jet/daemon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class Daemon extends EventEmitter {
return
}
this.routes[path] = new Route(peer, path, params.value)
if (params.value) {
if (typeof params.value !== 'undefined') {
this.subscriber.forEach((fetchRule) => {
if (this.simpleFetch() || fetchRule.matchesPath(path)) {
fetchRule.addRoute(this.routes[path])
Expand All @@ -116,7 +116,7 @@ export class Daemon extends EventEmitter {
change synchronous: First all Peers are informed about the new value then the message is acknowledged
*/
change = (peer: JsonRPC, id: string, msg: PathParams) => {
if (msg.path in this.routes && msg.value) {
if (msg.path in this.routes && typeof msg.value !== 'undefined') {
this.routes[msg.path].updateValue(msg.value)
this.respond(peer, id)
} else {
Expand Down

0 comments on commit 8f36960

Please sign in to comment.