Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No page re-render despite change in reactive value #282

Open
iisakkirotko opened this issue Sep 7, 2023 · 0 comments
Open

No page re-render despite change in reactive value #282

iisakkirotko opened this issue Sep 7, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@iisakkirotko
Copy link
Collaborator

On initial load, the page is not re-rendered even though the value of a reactive variable changes. In the example below, when the page is initially loaded, the value of var, as displayed in the Text component is None, even though in both the InputText and via clicking on the button, we find that the value has actually changed to become '!!!', see screenshot.

import solara

var = solara.Reactive(None)

def on_click():
    print(var)

@solara.component
def BugComponent(
    value: solara.Reactive[str],
    on_value = None,
):
        
    def on_change(event_value):
        value.set(event_value)

    if value.value is None:
        value.set('!!!')

    return solara.InputText(label='', value=value, on_value=on_change)

@solara.component
def Page():
    BugComponent(value = var)

    solara.Text(f"{var}")
    solara.Button('click', on_click=on_click)
image
@iisakkirotko iisakkirotko self-assigned this Sep 7, 2023
@iisakkirotko iisakkirotko added the bug Something isn't working label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant