Skip to content

Commit 7394309

Browse files
authored
Changes variable names to prevent bizarre client container sidebar issue (#320)
### Description It looks like in #299 the sidebar code was copy/pasted from the command section into the command page. Both pages uses the global variable named `command_data_obj`, so when there wasn't a container explicitly from the command entry, it just used the one from the page. In this PR, I namespaced the variable name to fix the command names in the list. Additionally, I removed an unused global that sorted/grouped all the commands. I've also noticed that the build times have shot up after #299 to around 50 seconds - which is bonkers. Given the repetitious nature of this page element, this should be abstracted into a macro and/or cached during build. At time of writing there is 416 pages rendered in this section, each one has to open 416 + 4 (json files that index all the commands). That means that generating this sidebar adds 174,720 JSON file opens and parses. I will file a seperate issue to track. ### Issues Resolved #319 ### Check List - [x] Commits are signed per the DCO using `--signoff` By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License. Signed-off-by: Kyle J. Davis <[email protected]>
1 parent 95ad933 commit 7394309

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

templates/command-page.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,21 @@ <h3>History</h3>
238238
{% set command_data = load_data(path= json_path, required= false) %}
239239
{% if command_data %}
240240
{% set command_obj_name = commands::command_obj_name(command_data= command_data) %}
241-
{% set command_data_obj = command_data[command_obj_name] %}
241+
{% set list_command_data_obj = command_data[command_obj_name] %}
242242
{% set command_display = command_obj_name %}
243-
{% if command_data_obj.container %}
244-
{% set command_display = command_data_obj.container ~ " " ~ command_display %}
243+
{% if list_command_data_obj.container %}
244+
{% set command_display = list_command_data_obj.container ~ " " ~ command_display %}
245245
{% endif %}
246246
{% set command_entry = [
247247
command_display,
248248
page.permalink | safe,
249-
command_data_obj.summary,
250-
command_data_obj.group
249+
list_command_data_obj.summary,
250+
list_command_data_obj.group
251251
] %}
252252
{% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %}
253253
{% endif %}
254254
{% endfor %}
255255
{% endfor %}
256-
{% set_global grouped = commands_entries | sort(attribute="3") | group_by(attribute="3") %}
257256

258257
<div class="sb-search-container">
259258
<input type="text" id="sidebar-search-box" placeholder="Search within documents" onkeyup="searchSidebarCommands()" />

0 commit comments

Comments
 (0)