Skip to content

In new angular v16 i'm getting ERROR TypeError: this.userQuery.select is not a function #1074

Open
@samiulllah

Description

@samiulllah

Is this a regression?

Yes

Description

After updating angular v11 to v16 the akita is giving error in angular
main.js:23 ERROR TypeError: this.userQuery.select is not a function at main.js:1:262487 at u.<computed> (polyfills.js:23:32704) at A.invokeTask (polyfills.js:23:9550) at Object.onInvokeTask (main.js:23:169287) at A.invokeTask (polyfills.js:23:9471) at A.runTask (polyfills.js:23:4559) at A.invokeTask (polyfills.js:23:10688) at A.invoke (polyfills.js:23:10578) at Z.s.args.<computed> (polyfills.js:23:32402)
my code chunk that raise this error is,
`ngOnInit(): void {
if (environment.phone) {
document.body.classList.add('phone');
} else {
document.body.classList.add('tablet');
}

this.screenOrientationService.lockPhone('portrait');

const userQuerySubscription = this.userQuery
.select('accessToken')
.pipe(
filter((v) => !!v),
first()
)
.subscribe(() => this.userStore.getDetails());

this.subscriptions.add(userQuerySubscription);`

I suspect that might be angular is consuming the state/store before it's avilable. Anyone else have such issue in new angular version? as it was working fine in old v11 of angular.

Please provide a link to a minimal reproduction of the bug

https://stackoverflow.com/questions/77354907/angular-v16-and-akita-is-giving-error-typeerror-this-userquery-select-is-not-a

Please provide the exception or error you saw

main.js:23 ERROR TypeError: this.userQuery.select is not a function
    at main.js:1:262487
    at u.<computed> (polyfills.js:23:32704)
    at A.invokeTask (polyfills.js:23:9550)
    at Object.onInvokeTask (main.js:23:169287)
    at A.invokeTask (polyfills.js:23:9471)
    at A.runTask (polyfills.js:23:4559)
    at A.invokeTask (polyfills.js:23:10688)
    at A.invoke (polyfills.js:23:10578)
    at Z.s.args.<computed> (polyfills.js:23:32402)

Please provide the environment you discovered this bug in

development

Anything else?

I'm suspecting that angular v16 consume stores/queries before they are avilable resulting in undefined.

Do you want to create a pull request?

No

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