Skip to content

Commit ff9876d

Browse files
Fix Enterprise sidebar state persistence (#1520)
* Fix Enterprise sidebar state persistence - Add enterprise route detection to SidebarState.sidebar_index - Enterprise sections now properly retain accordion state after reload - Integrates with existing sidebar indexing system Fixes issue where Enterprise sidebar sections don't retain their open/closed state after page reload, unlike other sections. Co-Authored-By: [email protected] <[email protected]> * Fix Components section accordion state and highlighting - Create separate index calculations for enterprise_usage_items and enterprise_component_items - Update sidebar_comp function to accept separate enterprise indices - Components section now properly retains accordion state and highlights active items - Follows existing pattern used by other multi-section sidebars Resolves issue where Components section accordion would close when clicking items and items wouldn't get highlighted due to shared enterprise_index parameter. Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
1 parent aa6ced9 commit ff9876d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pcweb/components/docpage/sidebar/sidebar.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ def sidebar_comp(
381381
graphing_libs_index: list[int],
382382
api_reference_index: list[int],
383383
recipes_index: list[int],
384-
enterprise_index: list[int],
384+
enterprise_usage_index: list[int],
385+
enterprise_component_index: list[int],
385386
#
386387
cli_ref_index: list[int],
387388
ai_builder_overview_index: list[int],
@@ -597,14 +598,14 @@ def sidebar_comp(
597598
"Enterprise Usage",
598599
enterprise.overview.path,
599600
enterprise_usage_items,
600-
enterprise_index,
601+
enterprise_usage_index,
601602
url,
602603
),
603604
create_sidebar_section(
604605
"Components",
605606
enterprise.components.path,
606607
enterprise_component_items,
607-
enterprise_index,
608+
enterprise_component_index,
608609
url,
609610
),
610611
class_name="flex flex-col items-start gap-6 p-[0px_1rem_0px_0.5rem] w-full list-none list-style-none",
@@ -637,7 +638,8 @@ def sidebar(url=None, width: str = "100%") -> rx.Component:
637638
graphing_libs_index = calculate_index(graphing_libs, url)
638639
api_reference_index = calculate_index(api_reference, url)
639640
recipes_index = calculate_index(recipes, url)
640-
enterprise_index = calculate_index(enterprise_items, url)
641+
enterprise_usage_index = calculate_index(enterprise_usage_items, url)
642+
enterprise_component_index = calculate_index(enterprise_component_items, url)
641643

642644
cli_ref_index = calculate_index(cli_ref, url)
643645
ai_builder_overview_index = calculate_index(ai_builder_overview_items, url)
@@ -653,7 +655,8 @@ def sidebar(url=None, width: str = "100%") -> rx.Component:
653655
graphing_libs_index=graphing_libs_index,
654656
api_reference_index=api_reference_index,
655657
recipes_index=recipes_index,
656-
enterprise_index=enterprise_index,
658+
enterprise_usage_index=enterprise_usage_index,
659+
enterprise_component_index=enterprise_component_index,
657660
ai_builder_overview_index=ai_builder_overview_index,
658661
cli_ref_index=cli_ref_index,
659662
#

pcweb/components/docpage/sidebar/state.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def sidebar_index(self) -> int:
5151
elif "hosting" in route:
5252
return 0
5353
elif "api-reference" in route:
54+
return 2
55+
elif "enterprise" in route:
5456
return 3
5557
else:
5658
return 0

0 commit comments

Comments
 (0)