Skip to content

HMR triggers infinite loop when awaiting a promise #17369

@Tyler-Petrov

Description

@Tyler-Petrov

Describe the bug

After any HMR changes to a page that awaits a promise, svelte starts to consume large amounts of resources.

This is page resources used before an HMR...
Image

...and this is about 40 seconds after the HMR (where the linear growth starts is when the HMR happened)
Image

The JS heap went from ~15MB to ~2GB.

Reproduction

<script lang="ts">
    import Inspect from "svelte-inspect-value";

    const testValue = await Promise.resolve("Promised Value");
</script>

<Inspect value={{ testValue: testValue }} />

The error starts in version 5.45.9 and continues into the latest version (5.46.0 at the time of writing).

Logs

System Info

Running in WSL

  System:
    OS: Linux 6.6 Arch Linux
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 4.59 GB / 15.57 GB
    Container: Yes
    Shell: 5.2.37 - /usr/bin/bash
  Binaries:
    Node: 22.17.0 - /home/tpetrov/.nvm/versions/node/v22.17.0/bin/node
    npm: 10.9.2 - /home/tpetrov/.nvm/versions/node/v22.17.0/bin/npm
    pnpm: 10.24.0 - /home/tpetrov/.local/share/pnpm/pnpm
    bun: 1.3.2 - /home/tpetrov/.bun/bin/bun
  npmPackages:
    svelte: ^5.46.0 => 5.46.0

Severity

blocking an upgrade

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