hummingbot / dashboard

Application that helps you create, backtest, deploy, and manage Hummingbot instances
Apache License 2.0
175 stars 115 forks source link

FIle explorer - Cannot create element outside a frame #65

Closed rapcmia closed 11 months ago

rapcmia commented 1 year ago

Describe the bug In the event that we close or edit a file, there are instances of the dashboard having a delay causing users to rapidly click the buttons resulting to error of streamlit_elements.core.exceptions.ElementsFrameError: Cannot create element outside a frame.

Note: for monitoring purpose and seems related to streamlit, workaround is to relaunch the dashboard page and should work again

2023-09-07 19:25:14.826 Uncaught app exception
Traceback (most recent call last):
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit_elements/core/frame.py", line 34, in new_frame
    yield
  File "/Users/rapcomia/github/dashboard/main/pages/master_conf/app.py", line 46, in <module>
    mc_board.launch_master_bot()
  File "/Users/rapcomia/github/dashboard/main/ui_components/launch_master_bot_card.py", line 36, in __call__
    with mui.Paper(key=self._key,
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit_elements/modules/mui.py", line 42, in __getattr__
    return new_element("muiElements", element)
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit_elements/core/frame.py", line 46, in new_element
    raise ElementsFrameError("Cannot create element outside a frame.")
streamlit_elements.core.exceptions.ElementsFrameError: Cannot create element outside a frame.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/Users/rapcomia/github/dashboard/main/pages/master_conf/app.py", line 48, in <module>
    mc_board.editor()
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit_elements/core/frame.py", line 41, in new_frame
    del session_state[ELEMENTS_FRAME_KEY]
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit/runtime/state/session_state_proxy.py", line 115, in __delitem__
    del get_session_state()[key]
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit/runtime/state/safe_session_state.py", line 125, in __delitem__
    raise KeyError(key)
KeyError: 'streamlit_elements.core.frame.elements_frame'
2023-09-07 19:25:15.012 Uncaught app exception
Traceback (most recent call last):
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/Users/rapcomia/github/dashboard/main/pages/master_conf/app.py", line 46, in <module>
    mc_board.launch_master_bot()
  File "/Users/rapcomia/github/dashboard/main/ui_components/launch_master_bot_card.py", line 36, in __call__
    with mui.Paper(key=self._key,
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit_elements/modules/mui.py", line 42, in __getattr__
    return new_element("muiElements", element)
  File "/Users/rapcomia/anaconda3/envs/dashboard/lib/python3.9/site-packages/streamlit_elements/core/frame.py", line 46, in new_element
    raise ElementsFrameError("Cannot create element outside a frame.")
streamlit_elements.core.exceptions.ElementsFrameError: Cannot create element outside a frame.

https://github.com/hummingbot/dashboard/assets/73840223/73020444-0c45-473d-b7a5-4fd48df0687a

Steps To Reproduce

  1. Open a couple of files then close or edit
  2. Observe that after click buttons and still not happening, dashboard page will crashed
  3. Check the error on terminal
david-hummingbot commented 11 months ago

Closing this out since this is a streamlit limitation and not a bug we can fix.