Skip to content

moutils.URLHash() not working since marimo 0.17.2 -> 0.17.3 update #7055

@bulletmark

Description

@bulletmark

Describe the bug

moutils.URLHash() works up to and including marimo 0.17.2. Doesn't return anything from 0.17.3 update (and still not working on current 0.17.6).

@SamarJyoti496 the commit that broke this is fd38537 which was included in 0.17.3. If I comment out line 226 in frontend/src/plugins/core/RenderHTML.tsx in current main branch (effectively disabling that commit) then it works again. Sorry, don't understand the PR or TS well enough to submit another PR.

Below is a simple example that does not work since 0.17.3. Clicked links in the sidebar work fine. However clicked links in the body do not update URLHash(), although they do update the browser URL window.

Will you submit a PR?

  • Yes

Environment

{
  "marimo": "0.17.6",
  "editable": false,
  "location": "/home/mark/Data/src/per/qld-state-cup/.venv/lib/python3.13/site-packages/marimo",
  "OS": "Linux",
  "OS Version": "6.17.6-arch1-1",
  "Processor": "",
  "Python Version": "3.13.9",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "--",
    "Node": "v25.1.0"
  },
  "Dependencies": {
    "click": "8.3.0",
    "docutils": "0.22.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.10",
    "narwhals": "2.10.1",
    "packaging": "25.0",
    "psutil": "7.1.3",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.16.1",
    "pyyaml": "6.0.3",
    "starlette": "0.50.0",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.15.0",
    "uvicorn": "0.38.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "altair": "5.5.0",
    "anywidget": "0.9.18",
    "loro": "1.8.2",
    "pandas": "2.3.3",
    "pyarrow": "21.0.0",
    "python-lsp-ruff": "2.3.0",
    "python-lsp-server": "1.13.1",
    "ruff": "0.14.3",
    "watchdog": "6.0.0"
  },
  "Experimental Flags": {}
}

Code to reproduce

# /// script
# requires-python = ">=3.13"
# dependencies = [
#     "marimo",
#     "moutils",
# ]
# ///

import marimo

__generated_with = "0.17.6"
app = marimo.App(width="medium", app_title="Sidebar Example")

with app.setup:
    import marimo as mo
    import moutils

@app.cell
def _():
    path = moutils.URLHash()
    return (path,)

@app.cell
def _():
    mo.md('# Sidebar Example').left()
    return

@app.cell
def _(path):
    PAGES = {
        '#page1': (mo.md('## Page 1 content\n[link to page 2](#page2)'), 'Page 1'),
        '#page2': (mo.md('## Page 2 content\n[link to page 3](#page3)'), 'Page 2'),
        '#page3': (mo.md('## Page 3 content\n[link to page 1](#page1)'), 'Page 3'),
    }

    # Output main page
    _page = PAGES.get(path.hash) or PAGES[list(PAGES)[0]]
    _page[0]
    return (PAGES,)

@app.cell
def _(PAGES):
    # Output sidebar
    mo.sidebar([mo.nav_menu({k: v[1] for k, v in PAGES.items()}, orientation='vertical')])
    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