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

Changes not applied on window resize #947

Closed
willyboy opened this issue Dec 20, 2018 · 12 comments · Fixed by #949
Closed

Changes not applied on window resize #947

willyboy opened this issue Dec 20, 2018 · 12 comments · Fixed by #949
Assignees
Labels
bug has pr A PR has been created to address this issue P2 Issue that is important to resolve as soon as possible
Milestone

Comments

@willyboy
Copy link

Bug Report

What is the expected behavior?

When I resize the window, I expect that the fxLayout.lt-md, ngStyle.gt-xs, fxFlexOrder, etc directives are applied.

What is the current behavior?

Page resize does not trigger changes in layout based on using the responsive directives.

Everything was working in beta 19, responsive layouts broken by 20, and as of 22, the layout works on page load but when resizing the page, the directives aren't applied.

What are the steps to reproduce?

In this stackblitz: https://stackblitz.com/edit/angular-flex-layout-seed-xoetvd?file=app/test.component.ts try resizing the window. The initial resize works but if you shrink it back, the style doesn't return to how it started out.

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

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

Is there anything else we should know?

@CaerusKaru
Copy link
Member

At first glance I have no idea what's going on. I'll have to investigate later in the day. Can confirm it's definitely an issue though, but not sure the size and scope yet.

@CaerusKaru CaerusKaru added this to the 7.0.0-beta.23 milestone Dec 20, 2018
@CaerusKaru CaerusKaru added the bug label Dec 20, 2018
@CaerusKaru CaerusKaru self-assigned this Dec 20, 2018
@willyboy
Copy link
Author

I did just notice that there's a console error associated with it that I didn't notice before:

TypeError: Cannot read property 'split' of undefined
    at LayoutAlignStyleBuilder.buildStyles (angular-flex-layout-seed-xoetvd.stackblitz.io/turbo_modules/@angular/[email protected]/bundles/flex-layout-flex.umd.js:1426)

@willyboy
Copy link
Author

And a bit more info:
The first section has fxLayoutAlign.lt-md="center center" but no fxLayoutAlign property because it should just use default for gt-sm. That seems to trigger the error. If I add an fxLayoutAlign property, the error seems to go away.

@CaerusKaru CaerusKaru added the P2 Issue that is important to resolve as soon as possible label Dec 20, 2018
@CaerusKaru
Copy link
Member

The plot thickens, because this issue only arises when there's also a fxLayout present on the element. Likely a bad interaction between the two (fxLayoutAlign has a soft dependency on fxLayout)

@willyboy
Copy link
Author

That gives some insight into a workaround if it's not an easy fix

@CaerusKaru
Copy link
Member

This became a larger issue, so I decided to patch the whole thing instead of using a workaround. The PR is here: #949 in case you're curious, and we'll get it in for the next release. Apologies again in the meantime.

@CaerusKaru CaerusKaru added the has pr A PR has been created to address this issue label Dec 21, 2018
@willyboy
Copy link
Author

@CaerusKaru Thanks! Don't apologize, this library helps us a ton. :)

@Fellach
Copy link

Fellach commented Dec 24, 2018

Hi @CaerusKaru

I'm not sure your fix covers the scenario below so I put it just in case

<header fxLayout="row" [fxHide]="myVar" [fxHide.xs]="true">

Also here the directives stop working and an element is still visible after resizing.

Thanks!

@CaerusKaru
Copy link
Member

@Fellach the issue you’re looking for is #945

@ArchanaVijayaragavan
Copy link

Hi @CaerusKaru ,

As per the changelog of the "@angular/flex-layout": "7.0.0-beta.23", could see the above mentioned #947 got fixed.

But post installing this latest version as well, the issue still persist. Request your help.

Thanks.

@naveedahmed1
Copy link

Any update on this? I am receiving below error with beta 7.0.0-beta.23

ERROR TypeError: this._delegate.setNgClass is not a function
    at NgClass.set [as ngClass] (common.js:3241)
    at DefaultClassDirective.push../node_modules/@angular/flex-layout/esm5/extended.es5.js.ClassDirective.updateWithValue (extended.es5.js:207)
    at MediaMarshaller.push../node_modules/@angular/flex-layout/esm5/core.es5.js.MediaMarshaller.updateElement (core.es5.js:3309)
    at MediaMarshaller.push../node_modules/@angular/flex-layout/esm5/core.es5.js.MediaMarshaller.setValue (core.es5.js:3197)
    at DefaultClassDirective.push../node_modules/@angular/flex-layout/esm5/core.es5.js.BaseDirective2.setValue (core.es5.js:605)
    at core.es5.js:443
    at Array.forEach (<anonymous>)
    at DefaultClassDirective.push../node_modules/@angular/flex-layout/esm5/core.es5.js.BaseDirective2.ngOnChanges (core.es5.js:437)
    at checkAndUpdateDirectiveInline (core.js:17257)
    at checkAndUpdateNodeInline (core.js:25086)

@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug has pr A PR has been created to address this issue P2 Issue that is important to resolve as soon as possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants