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

Issue with StateParams #840

Closed
p3pp8 opened this issue Mar 19, 2024 · 4 comments
Closed

Issue with StateParams #840

p3pp8 opened this issue Mar 19, 2024 · 4 comments

Comments

@p3pp8
Copy link

p3pp8 commented Mar 19, 2024

uirouter/core v6.1.0. I'm facing this issue:

modules.js?hash=5f47…9fe47f2ba01d:280243 TypeError: Cannot read properties of undefined (reading 'inherit')
    at StateParams.$inherit (modules.js?hash=5f47…47f2ba01d:309683:55)
    at StateService.href (modules.js?hash=5f47…47f2ba01d:311445:34)
    at BaseUrlRule.handler (modules.js?hash=5f47…47f2ba01d:313502:24)
    at UrlService.sync (modules.js?hash=5f47…47f2ba01d:313756:39)
    at modules.js?hash=5f47…7f2ba01d:313788:104
    at modules.js?hash=5f47…7f2ba01d:304237:125
    at Array.forEach (<anonymous>)
    at modules.js?hash=5f47…47f2ba01d:304237:94
    at Scope.$broadcast (modules.js?hash=5f47…47f2ba01d:284396:28)
    at afterLocationChange (modules.js?hash=5f47…47f2ba01d:280073:18)

Thanx for your help, really appreciated!

@bobgear-eic
Copy link

I am seeing the same thing in the StateParams.prototype.$inherit() function.

As the image below shows, the for on line 24 has iterated past a valid "#" parameters and then carries on to a key named "objectPresent", which is a property of the prototype. This return undefined and then the error when attempting to get the "inherit" property.
image

I'm trying to upgrade my hybrid application to Angular 16. Could this possibly be a version incmpatibility? This is what I have:
"@uirouter/angular": "^12.0.0",
"@uirouter/angular-hybrid": "^16.0.0",
"@uirouter/angularjs": "^1.1.0",
"@uirouter/core": "^6.1.0",
"@uirouter/rx": "^1.0.0",
"@uirouter/visualizer": "^7.2.1",
"angular-ui-router": "^1.0.29",
"angular": "~1.5.0",

Any help/advice gratefully received

Thanks

@wawyed
Copy link
Member

wawyed commented May 30, 2024

I believe this is the same as angular-ui/ui-router#3851 . You probably have custom prototype methods on the array that for some reason have been defined as enumerable. You should use Object.defineProperty (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) instead

@bobgear-eic
Copy link

@wawyed Thank you!
It's some pretty old code that I'm returning to and I never dreamed that I'd done this to the prototype!
I've been puzzling over this for hours and I had no recollection of it being right there in my own code - so thanks very much for the tip!

@wawyed
Copy link
Member

wawyed commented Jul 16, 2024

This should be now fixed in 6.1.1

@wawyed wawyed closed this as completed Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants