Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions renderers/lit/fixing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Debugging Report

## Issue 1: Nothing Renders (Fixed)

**Symptoms:**
The sample app starts, but the screen is blank. Console logs (added during debugging) showed:
`[Surface] #renderSurface. Renderer: false, Node: true`
Followed by:
`Surface cannot render content: {renderer: false, node: 'root-column'}`

**Root Cause:**
The `<a2ui-surface>` component requires a `renderer` property (an instance of `LitRenderer`) to convert the abstract component tree into Lit templates. The consumer (the sample shell app) was not providing this property, leaving it `null`.

**Solution:**
I modified `src/0.8/lit/components/surface.ts` to initialize the `renderer` property with a default instance using the `standardLitCatalogImplementation`. This ensures the Surface can render even if the parent application doesn't explicitly inject a renderer.

```typescript
// src/0.8/lit/components/surface.ts

// ... imports
import { standardLitCatalogImplementation } from "../standard_catalog_implementation/standard_catalog_lit.js";

// ... inside class Surface
@property({ attribute: false })
accessor renderer: LitRenderer | null = new LitRenderer(
standardLitCatalogImplementation
);
```

---

## Issue 2: "(no model)" Output (Pending)

**Symptoms:**
Components that use data bindings (like `Text`, `Image`, etc.) render the string `(no model)` instead of the actual data.
Logs added to `Text` component confirm:
`Text component missing dependencies: { processor: false, node: true }`

**Root Cause:**
It appears that the `LitRenderer` (and specifically component renderers like `litTextRenderer`) creates the Lit components (e.g., `<a2ui-text>`) but does not pass the `processor` property to them.
The rendering chain is `Surface` -> `LitRenderer` -> `ComponentRenderer` -> `LitComponent`.
The `Surface` has the `processor`, but it only calls `renderer.renderNode(node)`. It does not pass the `processor`. Consequently, the leaf components (which inherit from `Root`) have a `null` processor and cannot resolve paths like `text.path`.

**Solution:**
The robust solution is to use **Lit Context** to provide the `MessageProcessor` from the `Surface` (the provider) to all descendant components (consumers). This avoids needing to thread the `processor` argument through the generic `FrameworkRenderer` interfaces which are not aware of the processor.

**Steps to implement:**
1. Create a `processorContext` key.
2. Update `Surface` to provide this context.
3. Update `Root` (the base class for all A2UI Lit components) to `@consume` this context.

This will automatically make `this.processor` available in all components, resolving the `(no model)` issue.
4 changes: 2 additions & 2 deletions renderers/lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"default": "./dist/src/0.8/core.js"
},
"./ui": {
"types": "./dist/src/0.8/ui/ui.d.ts",
"default": "./dist/src/0.8/ui/ui.js"
"types": "./dist/src/0.8/lit/components/ui.d.ts",
"default": "./dist/src/0.8/lit/components/ui.js"
}
},
"type": "module",
Expand Down
18 changes: 8 additions & 10 deletions renderers/lit/src/0.8/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@
*/

export * as Events from "./events/events.js";
export * as Types from "./types/types.js";
export * as Primitives from "./types/primitives.js";
export * as Types from "./core/types/types.js";
export * as Primitives from "./core/types/primitives.js";
export * as Styles from "./styles/index.js";
import * as Guards from "./data/guards.js";
export { CatalogApi } from "./core/types/types.js";
export { type ComponentApi } from "./core/types/types.js";
export { standardCatalogApi } from "./core/standard_catalog_api/standard_catalog.js";
import * as Guards from "./core/data/guards.js";

import { create as createSignalA2uiMessageProcessor } from "./data/signal-model-processor.js";
import { A2uiMessageProcessor } from "./data/model-processor.js";
import A2UIClientEventMessage from "./schemas/server_to_client_with_standard_catalog.json" with { type: "json" };
import { create as createSignalA2uiMessageProcessor } from "./core/data/signal-model-processor.js";
import { A2uiMessageProcessor } from "./core/a2ui_message_processor.js";

export const Data = {
createSignalA2uiMessageProcessor,
A2uiMessageProcessor,
Guards,
};

export const Schemas = {
A2UIClientEventMessage,
};
Loading
Loading