Skip to content

Commit

Permalink
Fix get_recipe_page_title when working with non-root pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Nov 14, 2023
1 parent 4cbfbe6 commit 40ff964
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ def get_page_title(self, state) -> str | None:
)

def get_recipe_page_title(self, state) -> str | None:
return state.get(StateKeys.page_title) or self.title
example_id, run_id, uid = extract_query_params(gooey_get_query_params())
if not example_id and not run_id:
return state.get(StateKeys.page_title) or self.title
else:
recipe_doc_state = self.recipe_doc_sr().to_dict()
return recipe_doc_state.get(StateKeys.page_title) or self.title

def render(self):
with sentry_sdk.configure_scope() as scope:
Expand All @@ -186,15 +191,14 @@ def render(self):
self.render_report_form()
return

st.session_state.setdefault(StateKeys.page_title, self.title)
st.session_state.setdefault(
StateKeys.page_notes, self.preview_description(st.session_state)
)

if example_id or run_id:
with st.breadcrumbs(className="mt-5"):
st.breadcrumb_item(
self.title.upper(),
self.get_recipe_page_title(st.session_state).upper(),
link_to=self.app_url(),
className="text-muted",
style={"background-color": "#A5FFEE"},
Expand Down

0 comments on commit 40ff964

Please sign in to comment.