Skip to content

Commit

Permalink
fix: skip page autocomplete if section wasn't filled out
Browse files Browse the repository at this point in the history
  • Loading branch information
trag1c committed Jan 1, 2025
1 parent 5e10346 commit 02f9780
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/components/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ async def page_autocomplete(
if not (interaction.data and (options := interaction.data.get("options"))):
return []
section = next(
cast(str, opt["value"]) for opt in options if opt["name"] == "section"
(cast(str, opt["value"]) for opt in options if opt["name"] == "section"),
None,
)
if section is None:
return []
return [
Choice(name=name, value=name)
for name in sitemap.get(section, [])
Expand Down

0 comments on commit 02f9780

Please sign in to comment.