Delete a component in a big list of rendered ones?

Briefly, i can solve deleting a component by recreating a list of all components without that is selected to be deleted.

The problem of such the approach is having overhead of rendering again what is already rendered. What if delete one component within 200 components? it leads to sending data of 199 of them to a client side and loading a browser with creating all the rest.

Is there a way to signal a client side to delete a component by sending it an ID?
Something like this:

Input({'type': 'delete-button', 'index': MATCH}, 'n_clicks')
def delete_component(n_clicks):
    component_id = ctx.triggered_id.get('index')
    return DeletItSignal(component_id)  # Instead of return what to render sending a signal or whatever with ID to be deleted


With the addition of Patch in 2.9, you can now delete one item from a list without having to rerender all of them again.

That’s amazing. I don’t track version changes and stuck with 2.6+, thx for mentioning the version.

1 Like