Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ArrayInput linking fix #308

Merged
merged 2 commits into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/ArrayInput/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Observer } from '@playcanvas/observer';
import * as utils from '../../helpers/utils';

import Element, { ElementArgs, IBindable, IBindableArgs, IFocusable } from '../Element';
import Container from '../Container';
import Panel from '../Panel';
Expand Down Expand Up @@ -514,6 +514,20 @@ class ArrayInput extends Element implements IFocusable, IBindable {
this._inputSize.blur();
}

unlink() {
super.unlink();
this._arrayElements.forEach((entry: { element: Element; }) => {
entry.element.unlink();
});
}

link(observers: Observer|Observer[], paths: string|string[]) {
super.link(observers, paths);
this._arrayElements.forEach((entry: { element: Element; }, index: number) => {
this._linkArrayElement(entry.element, index);
});
}

/**
* Executes the specified function for each array element.
*
Expand Down