What problem does it solve?
GPUI context management across App, Window, Context<T>, AsyncApp, and AsyncWindowContext can be complex. This Skill provides a structured approach to coordinate UI rendering and entity updates by exposing typed contexts like App, Window, Context<T>, AsyncApp, and AsyncWindowContext.
Core Features & Use Cases
- Context type overview: App, Window, Context<T>, AsyncApp, AsyncWindowContext.
- State management and rendering: update entities, trigger re-renders via cx.notify.
- Async operations: spawn and manage background tasks while preserving UI context.
- Window management: open/close windows and perform window-specific operations within a component.
Use cases include building interactive components that react to state changes, coordinating multiple UI layers, and performing asynchronous work tied to specific contexts.
Quick Start
Use gpui-context to structure UI components around App, Window, and Context<T>. In a component update, modify state, call notify to re-render, spawn asynchronous work with cx.spawn, and access the current entity with cx.entity(). Open a window from the App context and create a Context<T> for a component to render.