Skip to content

Sibling states getting mixed up in new/update scenario #3523

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

Closed
1 of 3 tasks
dietergeerts opened this issue Aug 30, 2017 · 9 comments
Closed
1 of 3 tasks

Sibling states getting mixed up in new/update scenario #3523

dietergeerts opened this issue Aug 30, 2017 · 9 comments
Labels

Comments

@dietergeerts
Copy link

This is a:

  • Bug Report
  • Feature Request
  • General Query

My version of UI-Router is: 1.0.3

Bug Report

Current Behavior:

I have two states:

createState = {url: '/new'};
updateState = {url: '/:id'};

Now when loading the page with url mysite.com/users/new, it loads the updateState instead of the createState. A current workaround is to add the createState after the updateState on the $stateProvider, but that's harder to control as we use encapsulating modules for each thing to better control our dependencies, so a state file is like:

import angular from 'angular';
import uiRouterModule from '@uirouter/angularjs';
import {appLoginComponentModule} from '../login.component';
import {notAuthState} from '../../app.states';
import {loginResolve} from '../core/action/login.resolve';
import {appAuthModule} from '../../auth/core/auth';

export const loginState = {
    name: 'user_login',
    parent: notAuthState,
    url: '/login',
    component: 'appLogin',
    resolve: {
        login: loginResolve,
    },
};

export const appLoginStateModule = angular
    .module('app.login.state', [
        uiRouterModule,
        appAuthModule,
        appLoginComponentModule,
    ])
    .config(/* @ngInject */ ($stateProvider) => {
        $stateProvider.state(loginState);
    })
    .name;

And then we can add that dependency to the modules that needs it, and we can't be sure that the createState is added after the updateState with this.

Expected Behavior:

I would expect the ui-router to check of there is a sibiling state that hasn't a paramter, and check if that's a match first, so that order isn't important.

Link to Plunker that reproduces the issue:

If really needed, I can add one, just let me know.

@i23591326
Copy link

i23591326 commented Sep 1, 2017

I have a related issue:

In my case there are two states:
{name: '...dashboard.widget', url: '/widget:dashboard',...};
{name: '...dashboard.widgetconfig', url: '/widgetconfig:dashboard',...};

It works perfectly fine when i use ui-sref directive for state transition.
However when current state is ....widgetconfig and url is .../widgetconfig123, in case if i update browser page, uirouter will set ...widget state with url .../widgetconfig123!!! after app is loaded

uirouter/angularjs: 1.0.6,
uirouter/core: 5.0.6

@toxaq
Copy link

toxaq commented Sep 2, 2017

See also #1277 Utterly silent failings after an upgrade are very embarassing...

@toxaq
Copy link

toxaq commented Oct 13, 2017

Also seems to be intermittent. I've been able to run through this locally fine, deploy and then find that some routes are borked for some users and not necessarily reproducible...

@kfroemming
Copy link

I am having this issue as well. Has there been any progress?

@josduj
Copy link

josduj commented Feb 28, 2018

Updating to 1.0.15 fixed my issues

@dietergeerts
Copy link
Author

@josduj , problem is reported on 1.0.3. So that could mean that it was introduced after 1.0.15 or that your scenario is different

@toxaq
Copy link

toxaq commented Mar 5, 2018

@dietergeerts 1.0.15 is after 1.0.3 so I think @josduj is implying it might have been fixed? The problem is testing it. It was intermittent for me and seemed to be based on load orders (possibly with lazy loading at my end) so there was not replicatable test. I've upgraded to 1.0.15 but didn't remove the regexp fix as per #1277 (comment).

@dietergeerts
Copy link
Author

Oops. I saw 30 in my head. I'll try to upgrade and see if it's fixed.

@stale
Copy link

stale bot commented Jan 24, 2020

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues
may be reopened.

Thank you for your contributions.

@stale stale bot added the stale label Jan 24, 2020
@stale stale bot closed this as completed Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants