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

Timing error with overlay #8758

Closed
shanegilbert opened this issue Dec 1, 2017 · 2 comments · Fixed by #8761
Closed

Timing error with overlay #8758

shanegilbert opened this issue Dec 1, 2017 · 2 comments · Fixed by #8761
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@shanegilbert
Copy link

Bug, feature request, or proposal:

I get the following error when using Overlay only when my data is returned from cache instead of pulled from the API.

TypeError: Cannot read property 'style' of null
at GlobalPositionStrategy.apply

This appears to come from line 159 in
https://github.com/angular/material2/blob/master/src/cdk/overlay/position/global-position-strategy.ts

What is the expected behavior?

No error

What is the current behavior?

The error occurs

What are the steps to reproduce?

Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.

Plunker starter (using on @master): https://goo.gl/uDmqyY

StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV

https://stackblitz.com/edit/angular-ow2o5c

What is the use-case or motivation for changing an existing behavior?

It appears to be a timing related issue. I am attempting to create a waiting indicator service using the overlay components and the mat-spinner

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.0.1
Material/cdk 5.0.0.rc.2
Typescript 2.5.3

Is there anything else we should know?

@shanegilbert
Copy link
Author

One more thing. If you wrap the call to overlayRef.dispose() in the hide() method inside of a setTimeout({}, 0) then the error goes away.

@crisbeto crisbeto self-assigned this Dec 1, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 1, 2017
Fixes an error that is thrown by the `GlobalPositionStrategy` if its connected `OverlayRef` is disposed before the strategy is applied. This could happen, because the `OverlayRef` applies the position strategy asynchronously.

Fixes angular#8758.
@crisbeto crisbeto added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Dec 1, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 2, 2017
Fixes an error that is thrown by the `GlobalPositionStrategy` if its connected `OverlayRef` is disposed before the strategy is applied. This could happen, because the `OverlayRef` applies the position strategy asynchronously.

Fixes angular#8758.
andrewseguin pushed a commit that referenced this issue Dec 13, 2017
Fixes an error that is thrown by the `GlobalPositionStrategy` if its connected `OverlayRef` is disposed before the strategy is applied. This could happen, because the `OverlayRef` applies the position strategy asynchronously.

Fixes #8758.
andrewseguin pushed a commit to andrewseguin/components that referenced this issue Dec 19, 2017
…lar#8761)

Fixes an error that is thrown by the `GlobalPositionStrategy` if its connected `OverlayRef` is disposed before the strategy is applied. This could happen, because the `OverlayRef` applies the position strategy asynchronously.

Fixes angular#8758.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants