Skip to content

cleanup is not a function #2780

@Rich-Harris

Description

@Rich-Harris

If a deriver returns a non-falsy value, Svelte assumes it is a function, even if it isn't. This causes problems with e.g. async derivers:

const foo = writable(1);

// the deriver returns a promise
const bar = derived(foo, async ($foo, set) => {
  set($foo * 2);
});

Demo

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