Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Add null check to DataGrid actions setter #440

Open
bryanvb opened this issue Jul 18, 2022 · 0 comments
Open

Add null check to DataGrid actions setter #440

bryanvb opened this issue Jul 18, 2022 · 0 comments

Comments

@bryanvb
Copy link

bryanvb commented Jul 18, 2022

When wrapping the DataGrid and binding the actions input to a local variable in the wrapper we get an exception if the wrapper's input is not set to something.

For example:

@Component({
    selector: "vcd-rest-datagrid",
    template: `<vcd-datagrid [actions]="actions"></vcd-datagrid>`
})
export class VcdRestDatagridComponent {
    @Input()
    actions: ActionItem<R, unknown>[];
}

This will execute the DataGrid's actions setter with an undefined value. The setter then attempts to iterate the undefined value throwing an exception. Current workaround is to initialize the wrapper's actions variable to [] so that it can be iterated.

https://github.com/vmware/vmware-cloud-director-ui-components/blob/faf1a098a0875303835749cce62250c2a1c16c23/projects/components/src/datagrid/datagrid.component.ts#L358

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant