Skip to content
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

TypeError: Cannot read property 'name' of null ---- at QueryParamsService.updateURL #14

Open
mpanic opened this issue Oct 9, 2019 · 2 comments

Comments

@mpanic
Copy link

mpanic commented Oct 9, 2019

I have the following routes:

application/route.js (defines queryParam preCheck)
application/controll.js (defines alias queryParams.current.preCheck)
master/route.js (defines queryParam search)
master/controller (defined alias for queryParam queryParams.current.search)

Both routes have the same path: '/'

When I load the page, it throughs the following error:

TypeError: Cannot read property 'name' of null
    at QueryParamsService.updateURL (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/addon-tree-output/ember-query-params-service/services/query-params.js:66:1)
    at RouterService.router.on.transition (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/addon-tree-output/ember-query-params-service/services/query-params.js:34:1)
    at sendEvent (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/metal.js:463:1)
    at RouterService.trigger (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/runtime/lib/mixins/evented.js:110:1)
    at Class._router.on.transition (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/routing/lib/services/router.js:71:1)
    at sendEvent (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/metal.js:463:1)
    at Class.trigger (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/runtime/lib/mixins/evented.js:110:1)
    at PrivateRouter.routeWillChange (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/routing/lib/system/router.js:179:1)
    at Transition.abort (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/router_js.js:366:1)
    at PrivateRouter.transitionDidError (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/@ember/-internals/routing/lib/system/router.js:209:1)
    at Transition.promise.state.resolve.catch.result (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/router_js.js:270:1)
    at invokeCallback (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/rsvp.js:490:1)
    at publish (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/rsvp.js:473:1)
    at publishRejection (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/rsvp.js:409:1)
    at _runloop.backburner.schedule (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/ember-testing/lib/ext/rsvp.js:16:1)
    at invokeWithOnError (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/backburner.js:344:1)
    at Queue.flush (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/backburner.js:226:1)
    at DeferredActionQueues.flush (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/backburner.js:423:1)
    at Backburner._end (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/backburner.js:957:1)
    at Backburner._boundAutorunEnd (/var/folders/gv/h8f0csq173j19t15l_y9zfmm0000gn/T/broccoli-30947kl9I5HEIGpUt/out-655-append_ember_auto_import_analyzer/assets/backburner.js:626:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)

If I try to use preCheck it works just fine.
NOTE: it's in the application route

If I try to reference query param search from both router and controller, I get the error.
If I don't use it in either router or controller, it works just fine.
NOTE: it's in the "nested" master route, which is under application route.

What are the chances that we can't use queryParam from both router and controller in nested routes?

UPDATE:

After some debugging of the addon, looks like it fails as the transition.from and transition.to are both null and that makes sense as I'm loading the route for the first time.
But the error message is saying that "same query param" cannot be refered from both router and controller:

router.js:1211 Error while processing route: application.master Assertion Failed: You're not allowed to have more than one controller property map to the same query param key, but both `application:__INIT_WAS_CALLED__ember15706556339071062844181561__` and `application.master:__INIT_WAS_CALLED__ember15706556339071062844181561__` map to `__INIT_WAS_CALLED__ember15706556339071062844181561__`. You can fix this by mapping one of the controller properties to a different query param key via the `as` config option, e.g. `__INIT_WAS_CALLED__ember15706556339071062844181561__: { as: 'other-__INIT_WAS_CALLED__ember15706556339071062844181561__' }` 
    at assert (http://localhost:4200/assets/vendor.js:37145:15)
    at Class._queryParamsFor (http://localhost:4200/assets/vendor.js:24476:54)
    at forEachQueryParam (http://localhost:4200/assets/vendor.js:25099:26)
    at Class._deserializeQueryParams (http://localhost:4200/assets/vendor.js:24289:7)
    at getFullQueryParams (http://localhost:4200/assets/vendor.js:22925:12)
    at getQueryParamsFor (http://localhost:4200/assets/vendor.js:22938:27)
    at Class.paramsFor (http://localhost:4200/assets/vendor.js:21466:25)
    at Class._paramsFor (http://localhost:4200/assets/vendor.js:23582:23)
    at Class.deserialize (http://localhost:4200/assets/vendor.js:22304:30)
    at http://localhost:4200/assets/vendor.js:90041:81
@NullVoxPopuli
Copy link
Owner

Hi! sorry I've been away from this project for a while. :(

Is there code you can provide to help me more explicitly / accurately reproduce your scenario?

@NullVoxPopuli
Copy link
Owner

I finally got around to doing some maintenance on this repo and released a new version (as a v2 addon, and basically no other changes).

Any chance you can create a failing test that describes the desired behavior? thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants