Skip to content

Sidebar doens't render if cells block on initialization #1386

Closed
@mrdobalina2k

Description

@mrdobalina2k

Describe the bug

If a/some cell(s) in the marimo app take a long time to initialize (could be some database transfer, file reading etc), then, for whatever reason, the sidebar doesn't show up when running marimo run app.py.

Environment

{
"marimo": "0.5.2",
"OS": "Windows",
"OS Version": "11",
"Processor": "Intel64 Family 6 Model 126 Stepping 5, GenuineIntel",
"Python Version": "3.12.2",
"Binaries": {
"Browser": "123.0.6312.123",
"Node": "v14.16.0"
},
"Requirements": {
"click": "8.1.7",
"importlib-resources": "missing",
"jedi": "0.19.1",
"markdown": "3.6",
"pymdown-extensions": "10.7.1",
"pygments": "2.17.2",
"tomlkit": "0.12.4",
"uvicorn": "0.29.0",
"starlette": "0.37.2",
"websocket": "missing",
"typing-extensions": "4.9.0",
"black": "24.3.0"
}
}

Code to reproduce

here's a minimal repro, where one cell sleeps for 2 seconds to emulate a blocking thread (like an i/o operation)

 
import marimo
 
__generated_with = "0.5.2"
app = marimo.App(layout_file="layouts/sidebar.grid.json")
 
 
@app.cell
def __():
    import marimo as mo
    from time import sleep
    return mo, sleep
 
 
@app.cell
def __(mo):
    mo.sidebar(
        [
            mo.md("World"),
            mo.ui.switch()
 
        ]
    )
    return
 
 
@app.cell
def __(mo, sleep):
    sleep(2) # emulate blocking
    mo.md("Hi")
    return
 
 
if __name__ == "__main__":
    app.run()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions