Skip to content

Only update a $derived if a condition is met #16480

@Tyler-Petrov

Description

@Tyler-Petrov

Describe the problem

I have a form in my app (as one does), and I'm using Convex. The form initial data is updated automatically when the db data changes, but only when the form isn't tainted. I implemented this functionality with $effect, but I was so close to being able to just use $derived (let ... = $derived(...) is one of my favorite niche features of Svelte). The only reason I couldn't use $derived was there's no way to tell Svelte to only derive the value if a condition is met.

Describe the proposed solution

I'm not sure what the API or the implementation would look like, so I'll leave that to smarter folks than me.

Importance

nice to have

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