Skip to content

Transition error on nested routes #646

@AlexAndBear

Description

@AlexAndBear

Ember version: 3.13.2
Liquid-fire version: 0.31.0

Hello there, I have a very nested route structure, and I am facing an error when I try to transition from deep nested route to index.

This is my router.js

import EmberRouter from '@ember/routing/router';
import config from 'ember-get-config';

const Router = EmberRouter.extend({
  location: config.locationType,
  rootURL: config.rootURL,
});

Router.map(function() {
  this.route('login');

  this.route('settings', function() {
    this.route('me');
    this.route('users', function() {
      this.route('new');
      this.route('edit', { path: ':user_id' });
    });
    this.route('channels', function() {
      this.route('edit', { path: ':channel_id' });
    });
    this.route('measurement-methods', function() {
      this.route('edit', { path: ':measurement_method_id' });
    });
  });

  this.route(
    'measurement',
    { path: '/measurement/:measurement_id' },
    function() {
      this.route('meta', function() {
        this.route('project');
        this.route('building');
        this.route('measurement');
        this.route('customer');
        this.route('measurement-order');
      });
      this.route('detail', function() {
        this.route('chart');
      });
    },
  );
  this.route('measurement-compare');
});

export default Router;

transitions.js

export default function(){
  this.transition(
    this.use('toUp'),
    this.reverse('toDown'),
    this.debug(),
  );
}

I have implemented {{liquid-outlet}} everywhere, but if I try to transist from :

http://127.0.0.1:4200/measurement/OP4_s24B7pZs8twILklt/detail

or other any route on mearuement to e.G index via:

{{#link-to 'index'}}
go back
{{/link-to}}

I will end up with this error:

index.js:166 Uncaught Error: Assertion Failed: You attempted to generate a link for the "measurement.detail.index" route, but did not pass the models required for generating its dynamic segments. You must provide param `measurement_id` to `generate`.
    at assert (index.js:166)
    at Class.computeLinkToComponentHref (index.js:2862)
    at index.js:3339
    at untrack (index.js:1253)
    at ComputedProperty.get (index.js:3338)
    at Class.CPGETTER_FUNCTION [as href] (index.js:1044)
    at getPossibleMandatoryProxyValue (index.js:1275)
    at get (index.js:1348)
    at index.js:390

Seems, like the transition want let me walk back to /measurement instead of index.
If I use the standard {{outlet}} everything work fine,

hope you could help me out.
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions