flex-layout
flex-layout copied to clipboard
Null/undefined values in fx directives throwing error in console
Bug Report
What is the expected behavior?
No console errors in any situation
What is the current behavior?
Unknown console errors...
ERROR TypeError: Cannot read properties of undefined (reading 'split')
at DefaultLayoutAlignDirective.onLayoutChange (angular-flex-layout-flex.mjs:1108:42)
at Object.next (Subscriber.js:110:1)
at SafeSubscriber._next (Subscriber.js:60:1)
at SafeSubscriber.next (Subscriber.js:31:1)
at filter.js:6:48
at OperatorSubscriber._next (OperatorSubscriber.js:9:1)
at OperatorSubscriber.next (Subscriber.js:31:1)
at Subject.js:31:1
at errorContext (errorContext.js:19:1)
at Subject.next (Subject.js:26:21)
ERROR TypeError: Cannot read properties of undefined (reading 'split')
at LayoutAlignStyleBuilder.buildStyles (angular-flex-layout-flex.mjs:965:55)
at DefaultLayoutAlignDirective.addStyles (angular-flex-layout-core.mjs:1542:33)
at DefaultLayoutAlignDirective.updateWithValue (angular-flex-layout-flex.mjs:1102:14)
at MediaMarshaller.updateElement (angular-flex-layout-core.mjs:1355:17)
at angular-flex-layout-core.mjs:1313:26
at Map.forEach (<anonymous>)
at angular-flex-layout-core.mjs:1312:26
at Map.forEach (<anonymous>)
at MediaMarshaller.updateStyles (angular-flex-layout-core.mjs:1308:25)
at MediaMarshaller.onMediaChange (angular-flex-layout-core.mjs:1227:22)
What are the steps to reproduce?
Providing a StackBlitz (or similar) is the best way to get the team to see your issue.
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Win10 @angular/[email protected] @angular/[email protected] Chrome 101 [email protected]
Is there anything else we should know?
Please provide a minimal reproduction. There's no way for us to just divine the issue here.
Passing undefined to fxLayout
and fxLayoutAlign
directives throws this error.
I resolved the errors by adding fallback values when my variable is undefined.
I think passing null/undefined values should automatically render default values under the hood, so users don't get these errors when their values are unknowingly null/undefined.
cc: @CaerusKaru
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.