Skip to content

Unexpected Update Calls #3290

Closed
Closed
@deviprsd

Description

@deviprsd

Describe the bug
beforeUpdate is called twice when using bind:this to the same variable in logic blocks. Even though afterUpdate is schedule to be called after the last beforeUpdate it isn't

UPDATE: Exists even if bound to two different variables

Logs
REPL log

> Before null 
> After <button class="ui button">
> Before <button class="ui button">

To Reproduce
https://svelte.dev/repl/d85b4344f4044c4489b4e0260eabf475?version=3.6.8 (same variables)
https://svelte.dev/repl/7b1deb63003544358a6c4ee10ae28dcf?version=3.6.8 (different variables)

Expected behavior
If a single cycle isn't achieved, it should complete the cycle

> Before null 
> After <button class="ui button">
> Before <button class="ui button">
> After <button class="ui button">

Stacktraces

Stack trace
Error: "Custom message to generate Stack trace: beforeUpdate #counter-0 elasped-time(ms) 4"
    instance Button.svelte:43
    run index.mjs:18
    run_all index.mjs:24
    init index.mjs:1249
    Button bundle.js:896
    create_else_block$1 bundle.js:1105
    create_fragment$2 bundle.js:1316
    init index.mjs:1250
    SvelteMantic bundle.js:1403
    app index.js:9
    <anonymous> bundle.js:1429
Button.svelte:45:22

Error: "Custom message to generate Stack trace: afterUpdate #counter-1 elasped-time(ms) 18"
    instance Button.svelte:55
    flush index.mjs:570
    init index.mjs:1299
    SvelteMantic bundle.js:1403
    app index.js:9
    <anonymous> bundle.js:1429
bundle.js:826:18

Error: "Custom message to generate Stack trace: beforeUpdate #counter-2 elasped-time(ms) 20"
    instance Button.svelte:43
    run index.mjs:18
    run_all index.mjs:24
    update index.mjs:604
    flush index.mjs:560
    init index.mjs:1299
    SvelteMantic bundle.js:1403
    app index.js:9
    <anonymous> bundle.js:1429
Button.svelte:45:22

Error: "Custom message to generate Stack trace: Flush() elapsed-time(ms) 21"
    flush index.mjs:582
    init index.mjs:1299
    SvelteMantic bundle.js:1403
    app index.js:9
    <anonymous> bundle.js:1429
index.mjs:584:8

Error: "Custom message to generate Stack trace: Flush() elapsed-time(ms) 22"
    flush index.mjs:582
index.mjs:584:8

Information about your Svelte project:

  • Your browser and the version: Firefox 67

  • Your operating system: Ubuntu 18 LTS

  • Svelte version 3.6.8

  • Rollup

Severity
Severity is High, as the the cycle should always end with an afterUpdate and not beforeUpdate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions