Skip to content

Commit

Permalink
add conditional import;
Browse files Browse the repository at this point in the history
  • Loading branch information
m-wrzr committed Oct 28, 2023
1 parent 2930845 commit 8199344
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion streamlit_searchbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
import streamlit as st
import streamlit.components.v1 as components

try:
from streamlit import rerun as rerun # type: ignore
except ImportError:
# conditional import for streamlit version <1.27
from streamlit import experimental_rerun as rerun # type: ignore


# point to build directory
parent_dir = os.path.dirname(os.path.abspath(__file__))
build_dir = os.path.join(parent_dir, "frontend/build")
Expand Down Expand Up @@ -84,7 +91,7 @@ def _process_search(
st.session_state[key]["options_py"] = _list_to_options_py(search_results)

if rerun_on_update:
st.rerun()
rerun()


@wrap_inactive_session
Expand Down

0 comments on commit 8199344

Please sign in to comment.