eclipsesource / eclipsesource/tabris-js
Dispose operation executed prematurely when requested after reparenting
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
### Problem description
When disposing a container right after its children have been moved to another container, those children will not be laid out.
It seems that the dispose operation is executed right away, before the children update is flushed.
From `_removeChild(child)`:
https://github.com/eclipsesource/tabris-js/blob/7bd6a864a0c600a0d360724ef902c94bf7fd1626/src/tabris/widgets/Composite.js#L152
From `dispose()`:
https://github.com/eclipsesource/tabris-js/blob/7bd6a864a0c600a0d360724ef902c94bf7fd1626/src/tabris/NativeObject.js#L346
### Environment
- Tabris.js version: 3.3
### Code snippet
```javascript
import { Composite, TextView, contentView } from 'tabris';
let container = ;
let thing = ;
contentView.append(
container.append(
thing
)
);
setTimeout(() => {
thing.detach();
thing.appendTo(contentView);
container.dispose(); // does not work
// setTimeout(() => container.dispose()); // works
}, 2000);
```
Contributor guide
Assessment
This issue has not been assessed yet.