Add progressive breadcrumb resolution with caching

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-12 08:55:34 +00:00
parent 2f96bb6276
commit 29b1abc0a1
5 changed files with 452 additions and 80 deletions

View File

@@ -28,6 +28,7 @@ class Core_Bundle extends Rsx_Bundle_Abstract
'app/RSpade/Core/Models', // Framework models (User_Model, Site_Model, etc.)
'app/RSpade/Core/SPA',
'app/RSpade/Core/Debug', // Debug components (JS_Tree_Debug_*)
'app/RSpade/Breadcrumbs', // Progressive breadcrumb resolution
'app/RSpade/Lib',
],
];

View File

@@ -787,9 +787,19 @@ class Spa {
// Check if current container has a component with target class name
// jqhtml adds class names to component root elements automatically
const $existing = $current_container.children().first();
//
// Special case for first iteration (i=0):
// The top-level layout is rendered ON #spa-root itself, not as a child.
// $.component() converts the container element into the component.
// So we check if the container itself has the target class.
//
// For subsequent iterations:
// Sublayouts and actions are rendered into the parent's $content area.
// The $content element becomes the component (same pattern).
// So we still check if the container itself has the target class.
const $existing = $current_container;
if ($existing.length && $existing.hasClass(target_name)) {
if ($existing.hasClass(target_name)) {
// Match found - can potentially reuse this level
const existing_component = $existing.component();
@@ -848,19 +858,19 @@ class Spa {
// Create component
const component = $current_container.component(component_name, is_last ? args : {}).component();
// Wait for render to complete (not full ready - we don't need child data to load)
// This allows layout navigation to update immediately while action loads
await component.rendered();
if (i === 0) {
// Top-level layout - set reference immediately
Spa.layout = component;
}
if (is_last) {
// This is the action
// This is the action - set reference but don't wait
Spa.action = component;
} else {
// This is a layout
if (i === 0) {
// Top-level layout
Spa.layout = component;
}
// Wait for render to complete (not full ready - we don't need child data to load)
// This allows layout navigation to update immediately while action loads
await component.rendered();
// Move container to this layout's $content for next iteration
$current_container = component.$sid('content');