Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -225,8 +225,9 @@ def display_pet_card(pet, is_favorite=False):
|
|
225 |
col1, col2 = st.columns(2)
|
226 |
with col1:
|
227 |
if st.button("View Details", key=f"details_{pet['id']}"):
|
|
|
228 |
st.session_state.selected_pet = pet['id']
|
229 |
-
st.experimental_rerun() #
|
230 |
|
231 |
with col2:
|
232 |
if not is_favorite:
|
@@ -293,8 +294,9 @@ def display_pet_details(pet_id):
|
|
293 |
|
294 |
# Back button
|
295 |
if st.button("← Back to Search Results"):
|
|
|
296 |
st.session_state.selected_pet = None
|
297 |
-
st.experimental_rerun() #
|
298 |
|
299 |
# Pet name and status
|
300 |
st.markdown(f"<h1 class='main-header'>{pet['name']}</h1>", unsafe_allow_html=True)
|
|
|
225 |
col1, col2 = st.columns(2)
|
226 |
with col1:
|
227 |
if st.button("View Details", key=f"details_{pet['id']}"):
|
228 |
+
if st.session_state.selected_pet != pet['id']:
|
229 |
st.session_state.selected_pet = pet['id']
|
230 |
+
st.experimental_rerun() # Force immediate rerun
|
231 |
|
232 |
with col2:
|
233 |
if not is_favorite:
|
|
|
294 |
|
295 |
# Back button
|
296 |
if st.button("← Back to Search Results"):
|
297 |
+
if st.session_state.selected_pet is not None:
|
298 |
st.session_state.selected_pet = None
|
299 |
+
st.experimental_rerun() # Force immediate rerun
|
300 |
|
301 |
# Pet name and status
|
302 |
st.markdown(f"<h1 class='main-header'>{pet['name']}</h1>", unsafe_allow_html=True)
|