-
Notifications
You must be signed in to change notification settings - Fork 773
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
ObservableMedia: does not emit initial value in AOT mode #426
Comments
are you sure? Even without AOT, I don't always get an initial value of mqAlias. Not every time. I guess it is a race condition somewhere. Yes I ended up isActive()ing every breakpoint. |
Hmmm, actually I haven't had trouble with the initial value outside of AOT mode, but I did notice that it wasn't emitting a value after changing router states and returning back. That being the case, I ended up using Maybe a |
@denver-HJS, @alexeagle - can you confirm these issues are STILL present with the nightly build ? |
I'm not seeing any change using build @angular/[email protected] With AOT:
Without AOT:
Is that the latest nightly build? |
@denver-HJS, Yes that is the latest build. Ok, we will track this one day and kill this bug! |
same as @alexfung888 Even without AOT, I don't always get an initial value. that happens when I resize window larger and smaller to trigger different breakpoints. After that, I never get the initial value. Edit: I am using the nightly build |
@crysislinux - We are aware of this issue and working on a fix. |
@crysislinux - using the @angular/cli v1.5.0-rc2 and next version of Flex-Layouts, I am not seeing any problems with ObservableMedia when a demo application is served with
|
When using the latest build from github.com/angular/flex-layout-builds, |
Closing as not-an-issue. |
I might be wrong, but it seems to be linked to cli - present or not. I run two versions of my application atm, one using cli, the other on webpack custom ; cli version does trigger It would be useful to have a workaround cleaner than |
I have a similar issue. When I maximize the window, the ObservableMedia does not emit a new value, running 'ng serve' |
@CaerusKaru - can you investigate this... using PR 586 ? |
To be more accurate on the issue I'm experiencing: |
Another addition: Binding on the window.resize event, and checking which breakpoint is active gives me the following result:
|
I'm seeing an issue as well. Using
This does not log until I resize the window. I'd expect that it would log immediately when the app launches? Edit: After more testing I can see if the screen is small or x-small the value emits immediately. Anything greater (medium, large, x-large) does not. |
As an update to this issue, we're looking at migrating the CDK's Media engine and deprecating |
After the post-mortem on the beta20/beta21 issues, we've realized that a similar thing might be happening here. We're going to patch it in beta 23 (slated for Jan 2019 release). |
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage * cleanup tests: excessive use of `async()`. Fixes #648, Fixes #426.
Note: The method behavior has changed for isActive() I was doing something similar with the initial state (the 'startWith' trick), but when updating to the latest version all my initial states broke. Previously you would provide an alias, but now (which makes more sense) you need to pass the actual media query.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I've noticed a subtle difference in behavior in the ObservableMedia service when building with the CLI's AOT mode being on vs off.
I have a component property that dictates the responsive display of a section of content, and it's initialized via the subscription to the media change observable:
This works fine in non-AOT mode as the active mqAlias is available when the application loads. However, in AOT mode no value is emitted until a window resize event is triggered.
Since there is no direct query to the service available to get the current mqAlias, I am left with a less desirable brute force approach of querying individual possibilities using the
isActive
API method.The text was updated successfully, but these errors were encountered: