Skip to content

Callback on render finish #10341

@netcodedev

Description

@netcodedev

Describe the problem

I have a Component that renders stuff based of values inside a svelte-store. I now need to execute some code after svelte is done rendering after the underlying data has changed. Currently I have to use setTimeout(()=>{ <the code> },0) which works, but seems like a very hacky way. It would be neat to be able to register a function which is being called every time parts of the component are finished rendering.

Describe the proposed solution

Lets assume there is a Component that accepts data and renders the data via the {@each} blocks
The Callback could be registered like this:

<SomeComponent {data} on:renderfinish={doSomething} />

Whenever data changes, which causes SomeCompnent to render differently doSomething should be called after svelte is done rendering

Importance

would make my life easier

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions