blackary / st_pages

An experimental version of Streamlit Multi-Page Apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad message format Cannot read properties of undefined (reading 'pageScriptHash')

bonfire27 opened this issue · comments

When I am interacting with a page (therefore causing reruns) and the icons for the pages are appearing normally (there's times that they don't appear) I sometimes get the message on streamlit:

Bad message format
Cannot read properties of undefined (reading 'pageScriptHash')

It will also sometimes if I am not in the main page redirect you to a page http://localhost:8501/undefined that doesn't exist. If i enter that url in the browser it gives "page not found".
if you keep interacting with this ghost page it will go back to the real one eventually. But in these changes back and forth from the ghost page all the session_state is lost which is pretty annoying and makes the app unusable.

The bug though disappears if I use version st-pages==0.4.1 and I think it's related to the component st_aggrid because only when I have an AgGrid that the ghost page and session state delete occurs. For the other pages it's only the message Bad message format Cannot read properties of undefined (reading 'pageScriptHash')

This is related to this post I made in the streamlit forums:
https://discuss.streamlit.io/t/using-aggrid-sometimes-changes-the-page-to-undefined-reseting-the-session-state/50090

I return st-pages vision to 0.4.1, when I refresh the main page: http://*.*.*.*:8501 frequently. the pageScriptHash will be shown a low probability. my streamlit version is 1.30.0

an interesting thing is that: when pageScriptHash appears, the sidebar will not be shown.

11

i use a simple code to reproduce this bug:

import streamlit as st

# Either this or add_indentation() MUST be called on each page in your
# app to add indendation in the sidebar
add_page_title()

# Specify what pages should be shown in the sidebar, and what their titles and icons
# should be
show_pages(
    [
        Page("streamlit_app.py", "Home", ":house:"),
        Section("account", icon=":balloon:"),
        Page("account/register.py", "register", ":books:", in_section=True),
        Page("account/forget_pwd.py", "forgotpwd", ":books:", in_section=True),
        Page("account/forget_name.py", "forgotname", ":books:", in_section=True),
    ]
)

st.write("this is a big content")
st.write("this is a big content")
st.write("this is a big content")

another thing: @blackary
when i comment the Section , the alert never be shown.
i like Section , it makes the page clear.

show_pages(
    [
        Page("streamlit_app.py", "Home", ":house:"),
        #Section("account", icon=":balloon:"),
        Page("account/register.py", "register", ":books:", in_section=True),
        Page("account/forget_pwd.py", "forgotpwd", ":books:", in_section=True),
        Page("account/forget_name.py", "forgotname", ":books:", in_section=True),
    ]
)

did either of you find a solution to this problem?