Skip to content

DOM replacement breaks when a component child is in the middle of an out animation #5808

@awmcclain

Description

@awmcclain

Describe the bug
There's a race condition when you replace a component that has a child with an out transition that is currently running, svelte dies.

In production, we see the old component stay on the page in addition to the component replacing it, and we don't see any console errors on this (with svelte 3.29.4).

In REPL there's an exception and JS dies.

Logs
Uncaught (in promise): if_block.p is not a function (only in REPL, version 3.31.0)

To Reproduce
https://svelte.dev/repl/46686d49624a4f099f738998fbe5301c?version=3.31.0

Expected behavior
Out transition of the child would be killed, the whole component would be replaced.

Information about your Svelte project:

  • Your browser and the version: (e.x. Chrome 52.1, Firefox 48.0, IE 10)
    tested in chrome and safari

  • Your operating system: (e.x. OS X 10, Ubuntu Linux 19.10, Windows XP, etc)
    OS X

  • Svelte version (Please check you can reproduce the issue with the latest release!)
    3.29.4 and 3.31.0

  • Whether your project uses Webpack or Rollup

Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?

We can work around it (also shown in the REPL) but it's a real gotcha, especially with production code that has nested components.

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