From c3bb7d8b9d24d3508e075680d52199a5645fcd61 Mon Sep 17 00:00:00 2001 From: Offir Golan Date: Wed, 2 Aug 2017 14:21:52 -0700 Subject: [PATCH] Use keys to determine if there is a change or not The previous implementation would fail if the value of the changed key would be falsy. --- addon/-private/parachute-event.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/-private/parachute-event.js b/addon/-private/parachute-event.js index bd60e60..5721c3e 100644 --- a/addon/-private/parachute-event.js +++ b/addon/-private/parachute-event.js @@ -29,6 +29,7 @@ export default class ParachuteEvent { constructor(routeName, controller, changed = {}) { let { queryParams, queryParamsArray } = QueryParams.metaFor(controller); let state = QueryParams.stateFor(controller); + let changedKeys = keys(changed); /** * The route the event was fired from @@ -41,7 +42,7 @@ export default class ParachuteEvent { * @type {object} */ this.changed = queryParamsArray.reduce((changedParams, qp) => { - if (changed[qp.as]) { + if (changedKeys.includes(qp.as)) { changedParams[qp.key] = canInvoke(qp, 'deserialize') ? qp.deserialize(changed[qp.as]) : changed[qp.as]; } return changedParams;