ironmansoftware / universal-dashboard

Build beautiful websites with PowerShell.
https://universaldashboard.io
GNU Lesser General Public License v3.0
449 stars 83 forks source link

internal variable #1585

Open augiaugi opened 4 years ago

augiaugi commented 4 years ago

Describe the Issue

I came across that my components are getting $null value from the parameter I pass to the functions.

function New-AppBar 
{
    param
    (
        [string]$Titel
    )

    New-UDHelmet -Content {
        New-UDHtmlTag -Tag 'title' -Content { 
            $Titel
        }
    }

    $Drawer = New-UDDrawer -Children {
        New-UDList -Children {
            ...
        }
    }

    New-UDAppbar -Children {
        New-UDElement -Tag 'div' -Content { 
            $Titel
        }
    } -Drawer $Drawer
}

New-AppBar -Titel 'ObjectType'

I figured out that after changing the property from -Titel to -Text anything worked as expected. Title is an internal property of UD or one of the component and this can be the reason that my variable was $null.

A error message would have saved me a lot of time and I think this is not the only example that can happen.

Version Information

augiaugi commented 4 years ago

@adamdriscoll

Is this change resolving my issue?

https://github.com/ironmansoftware/universal-dashboard/commit/1e3e13af47f92376364b5274eec3fc61df1cef1c

adamdriscoll commented 4 years ago

I don't think so. It's just preventing variables like $error from being overwritten. I don't see anywhere in UD where we are setting a variable -Titel

augiaugi commented 4 years ago

@adamdriscoll

Can you reproduce the issue too?