Fuse.Controls.Page already has a parent

Hi,

when we have a PageControl whose pages are dynamic (with Each) and a binding for the Active page, the apps fails with :

Fuse.Controls.Page already has a parent

Here is my code :

MainView.ux

<App Theme="Basic" Background="#eeeeeeff">
    <JavaScript File="MainView.js" />
    <DockPanel>
        <PageControl Active="{currentPage}">
            <Each Items="{pages}">
                <Page Name="{name}">
                    <Rectangle>
                        <Text Value="{name}" />
                    </Rectangle>
                </Page>
            </Each>
        </PageControl>
    </DockPanel>
</App>
`

MainView.js

var Observable = require('FuseJS/Observable');

var pages = Observable();
pages.add({
    name: 'page1'
});
pages.add({
    name: 'page2'
});
pages.add({
    name: 'page3'
});

var currentPage = Observable('page2');

module.exports = {
    pages: pages,
    currentPage: currentPage
};

A possible workaround is :

var currentPage = Observable();

setTimeout(function() {
    currentPage.value = 'page2'
}, 1000);

but it easily becomes very tricky when the app is a little more complex.

Thanks !

Hi, Thanks for reporting this problem. We’ll take a look!

We’ve found a race condition, and it will be fixed in an upcoming release.

Thanks again for the test case, which made the problem easy to isolate :slight_smile:

Wow that was fast :stuck_out_tongue:

Perfect thanks !

Should be out now in 0.9.5 :slight_smile:

https://www.fusetools.com/downloads/channel/qa (now)

https://www.fusetools.com/downloads/ (in a few hours)