Skip to content

SFCascaderWidgetSchema show the "previous" elements's children when its children is null #1827

@InbarTakdim

Description

@InbarTakdim

Reproduction link

https://stackblitz.com/edit/ng-alain-setup

Steps to reproduce

{
			type: 'number',
			title: this.i18n.fanyi('app.filter.label.department'),
			ui: {
				changeOnSelect:true,
				widget: 'cascader',
				placeholder: this.i18n.fanyi('vehicle.filter.placeholder.department'),
				class: 'selected-department',
				allowClear: true,
				showArrow: true,
				menuClassName: 'departments-menu',
				columnClassName: 'department-column',
				change: (value: number[]) => {
					onChange(value);
				},
				asyncData: (node) => {
					if (node.level >= 0) {
						return this.departmentWidgetService.getRolesByDepartment(node);
					} else {
						return new Promise(resolve => {
							setTimeout(() => {
								this.departmentWidgetService.initDepartments().then((res) => {
									(node as any).children = res;
									resolve();
								});
							},);
						});
					}
				},
			} as SFCascaderWidgetSchema,
		};

in this case if i choose something that has children and then something without children it still show the children of the previous one.

What is expected?

if there are no children - don't show the "children menu"

What is actually happening?

showing the children of the previous one

Environment Info
ng-alain 9.5.5
Browser chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions