flex-layout icon indicating copy to clipboard operation
flex-layout copied to clipboard

fxHide with custom breakpoint directive not working in AOT

Open hags033 opened this issue 7 years ago • 8 comments

Bug Report

What is the expected behavior?

Expect for the element to hide at desired custom breakpoint

What is the current behavior?

Element hides at desired custom breakpoint when not running aot, but does not hide in aot

What are the steps to reproduce?

https://stackblitz.com/edit/angular-flex-layout-seed-j5xkix

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

Adding in a min-height breakpoint

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

Angular 7.1.4, Typescript 3.1.6 Flex Layout 7.0.0-beta.22 all browsers

Is there anything else we should know?

You'll need to download the stackblitz and run ng serve (angular.json already set to run aot build)

hags033 avatar Dec 27 '18 20:12 hags033

The StackBlitz you've provided contains no trace of custom breakpoints. Please add it and then follow-up here.

CaerusKaru avatar Dec 28 '18 03:12 CaerusKaru

Forgot to hit save on the stackblitz, the demo link is now up to date.

hags033 avatar Dec 28 '18 14:12 hags033

Damn that is a terrible bug. I'll investigate this weekend and hopefully track this down. Thanks for catching this!

CaerusKaru avatar Dec 28 '18 16:12 CaerusKaru

@CaerusKaru - this is working great with the latest code base. I added it to our demos. But [as reported] the custom hide bp does NOT work with AOT...

/**
 * This one fails to instantiate in demo app with AOT!!
 */
@Directive({selector, inputs})
export class CustomHideDirective extends ShowHideDirective {
   protected inputs = inputs;
}

// ****************************************
// Core Library 
// ****************************************

/**
 * Core ‘show’ Layout API directive
 */
@Directive({selector, inputs})
export class DefaultShowHideDirective extends ShowHideDirective {
  protected inputs = inputs;
}

export class ShowHideDirective extends BaseDirective2 implements AfterViewInit, OnChanges {
  constructor(protected elementRef: ElementRef,
              protected styleBuilder: ShowHideStyleBuilder,
              protected styler: StyleUtils,
              protected marshal: MediaMarshaller,
              @Inject(LAYOUT_CONFIG) protected layoutConfig: LayoutConfigOptions,
              @Inject(PLATFORM_ID) protected platformId: Object,
              @Optional() @Inject(SERVER_TOKEN) protected serverModuleLoaded: boolean) {
    super(elementRef, styleBuilder, styler, marshal);
  }

 //....
}

export abstract class BaseDirective2 implements OnChanges, OnDestroy {
  protected constructor(protected elementRef: ElementRef,
                        protected styleBuilder: StyleBuilder,
                        protected styler: StyleUtils,
                        protected marshal: MediaMarshaller) {
  }

 //....
}

ThomasBurleson avatar Jan 04 '19 21:01 ThomasBurleson

There's a chance this was patched by #978. @hags033 can you build this against 7.0.0-beta.23 and see if the issue still exists?

CaerusKaru avatar Jan 11 '19 02:01 CaerusKaru

Anecdotally I can confirm this has been patched by updating the StackBlitz and running ng serve --aot locally. If this is still an issue, we can reopen later.

CaerusKaru avatar Jan 11 '19 02:01 CaerusKaru

@CaerusKaru works great, thanks for addressing this so quickly.

hags033 avatar Jan 11 '19 14:01 hags033

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.