mljar / mercury

Convert Jupyter Notebooks to Web Apps

Home Page:https://RunMercury.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic Widgets don't work when continuous update is off

kapily opened this issue · comments

This is related to the other bug:
#350

Repro:

import mercury as mr

app = mr.App(
    continuous_update=False,
)

select_a = mr.Select(value="a-", choices=["a-", "b-", "c-"], label="Prefix", url_key='prefix')
prefixes = {
    'a-': ['apple', 'asparagus', 'astronaut'],
    'b-': ['banana', 'basketball', 'bot'],
    'c-': ['cat', 'cantelope', 'charge'],
}
select_b = mr.MultiSelect(value="", choices=prefixes[select_a.value], label="Words", url_key='words')

Note how "dynamic widgets" don't work.

While this might be working as intended, it would be nice to be able to separate out dynamically loading the
widgets vs dynamically loading the output.

Use case: clicking run is expensive and you only want to run when the user explicitly clicks on Run after verifying they selected all the right options.

However, URL linking does still work:
If you visit:
http://localhost:4000/app/repro-2?prefix=c-&words=
You will be able to the c words right after loading

However, there is still a bug
If you paste the URL:
http://localhost:4000/app/repro-2?prefix=c-&words=cantelope
While c will be selected, cantelope will not

Similar to the other issue, this URL works:
http://localhost:4000/app/repro-2?prefix=a-&words=apple

Indicating that dynamic widgets only work to select default dropdown variables.