fix: extract render_workspace_tree macro, fix sidebar-tree endpoint
FlowDeck CI / test (push) Failing after 4s
FlowDeck CI / docker (push) Has been skipped

- Extracted render_workspace_tree macro into _workspace_tree_macro.html
  so it can be imported independently from base.html (which has many
  template variables like user, workspace_name, etc.)
- Fixed GET /api/sidebar/workspace-tree to use the extracted macro
- Added error logging for easier debugging
This commit is contained in:
2026-07-16 08:58:05 -04:00
parent 6f40c8953a
commit f6a022edf2
3 changed files with 49 additions and 47 deletions
+4 -3
View File
@@ -1554,15 +1554,16 @@ async def sidebar_workspace_tree(request: Request):
'<span class="page-name text-dim">No pages yet</span></li>'
)
# Render the tree using the same Jinja2 macro as base.html
# Render the tree using the extracted macro
env = Environment(loader=FileSystemLoader("app/templates"))
template = env.from_string(
"{% from 'base.html' import render_workspace_tree %}"
"{% from '_workspace_tree_macro.html' import render_workspace_tree %}"
"{{ render_workspace_tree(pages) }}"
)
html = template.render(pages=pages)
return HTMLResponse(html)
except (ValueError, Exception):
except (ValueError, Exception) as e:
logger.error(f"sidebar_workspace_tree failed: {e}", exc_info=True)
return HTMLResponse(
'<li class="sidebar-item empty-hint"><span class="page-icon">📄</span>'
'<span class="page-name text-dim">No pages yet</span></li>'