Skip to content

Widgets initialized in a reactive.effect are unexpectedly removed #190

@cpsievert

Description

@cpsievert

Related to #174

Clicking the button in the app below will (expectedly) add a new marker, but (unexpectedly) remove the previously added marker.

from ipyleaflet import Map, Marker
from shiny import reactive
from shiny.express import input, ui

from shinywidgets import render_widget

ui.input_action_button("add", "Add Marker")

m = Map(center=(5, 5), zoom=5)

@render_widget
def map():
    return m

@reactive.effect
@reactive.event(input.add)
def _():
    marker = Marker(location=(input.add(), input.add()))
    m.add(marker)

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