Skip to content

beforeUpdate and afterUpdate not backwards compatible #14564

@PeytonHanel

Description

@PeytonHanel

Describe the bug

Svelte 5 in legacy mode is supposed to be backwards compatible with Svelte 4 so that we can migrate our projects slowly. I just upgraded to Svelte 5 to find that beforeUpdate and afterUpdate don't work as expected anymore.

Reproduction

Svelte 4 (works):
https://svelte.dev/playground/8f0ca6b1708d431d95a3d457a7a5c8d1?version=4.2.19

Svelte 5 (doesn't work):
https://svelte.dev/playground/8f0ca6b1708d431d95a3d457a7a5c8d1?version=5.6.2

You should be seeing console output every time you press the button, but it doesn't work in Svelte 5.

Logs

No response

System Info

System:
    OS: macOS 14.7.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 138.38 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.7.0 - /opt/homebrew/bin/node
    npm: 10.8.2 - /opt/homebrew/bin/npm
    pnpm: 9.9.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 131.1.73.91
    Chrome: 131.0.6778.109
    Edge: 131.0.2903.70
    Safari: 18.1.1
  npmPackages:
    svelte: ^4.2.19 => 4.2.19

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