Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

<:Component> Inside other tag mount to null #993

Closed
antonheryanto opened this issue Dec 9, 2017 · 2 comments · Fixed by #994
Closed

<:Component> Inside other tag mount to null #993

antonheryanto opened this issue Dec 9, 2017 · 2 comments · Fixed by #994
Labels

Comments

@antonheryanto
Copy link

antonheryanto commented Dec 9, 2017

Hi, thank for such wonderful project

just stumble upon Dynamic component bugs.
provided REPL of bug

when <:Component> inside other

<div>
<:Component {view}></:Component>
</div>

switching to other type causing null error as compiled code mount to null.parentNode

m: function mount(target, anchor) {
    insertNode(h1, target, anchor);
    insertNode(text_1, target, anchor);
    insertNode(div, target, anchor);
    if (switch_instance) switch_instance._mount(div, null);
},

p: function update(changed, state) {
    if (switch_value !== (switch_value = state.view)) {
        if (switch_instance) switch_instance.destroy();

        if (switch_value) {
            switch_instance = new switch_value(switch_props(state));
            switch_instance._fragment.c();
            switch_instance._mount(null.parentNode, null);
        }
    }
},
@Rich-Harris
Copy link
Member

thank you! fixed in 1.46.1

@antonheryanto
Copy link
Author

Thank you very much

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

Successfully merging a pull request may close this issue.

2 participants