AIR Stack v1.2 — SSR Refactor & Form Auto-Detection
v1.2.0 — GitHub | MIT Licensed
This release brings significant improvements to the airSSR Vite plugin, resolves a critical React context loss issue during snippet re-rendering, enforces stricter peer dependency resolution, and introduces auto-detection for standalone inputs in AIR Form.
Peer Dependencies Enforcement
To prevent issues with multi-instance core packages (where multiple versions of @anchorlib/core or other core packages are bundled simultaneously), all AIR Stack packages have moved their core dependencies to peerDependencies. Additionally, the versions are now fixed (e.g., 1.2.0 instead of ^1.2.0) to guarantee stability and prevent mismatches across the ecosystem.
Vite SSR Modularization
The airSSR Vite plugin has been deeply refactored to improve maintainability and guarantee proper module resolution during server-side rendering.
- Automated Externalization: Added a
confighook to automatically inject^@irpclib/and^@anchorlib/into Vite'sssr.noExternalconfiguration. - Standalone Handlers: The monolithic request middleware has been broken down into dedicated
resolveHttpCallsandresolveSSRfunctions. - Cached Initialization: Introduced a cached
bootstrapfunction to initialize and preserve IRPC routers, the renderer factory, and the template path across requests, preventing redundant module loads. - HMR Support: Added a
bootstrapHandlershelper to streamline IRPC handler loading for initial requests and Hot Module Replacement (HMR) updates. - Type Safety: Improved explicit type imports for HTTP requests, IRPC packages, and WebSocket transports.
React Context Preservation
Resolved a bug in the React adapter where scope context was lost when Snippet components re-rendered:
- Introduced internal
StartandFinishcomponents to manage context setup and restoration. - Modified
SnippetBodyto capture and restore context tightly around render operations. - Added
getContextStoreto accurately track the current context state, ensuring fine-grained reactivity survives React's re-rendering cycles.
AIR Form v1.2 Updates
- Field Blocking Mechanism: Added
form.block(key)andform.unblock(key)to the form engine, allowing manual control over form submission readiness for async operations and complex state conditions. - Mismatch Validation in UI:
<Field>now natively handlesmatchandmismatchLabelprops. When a field passes schema validation but fails the match condition, the mismatch label is displayed automatically withrole="alert". - Match Optimization: Wrapped field matching logic in
untrackto prevent unnecessary re-execution of match functions during unrelated state changes. - Auto-Detection: Input components used directly inside a
<Form>(without a<Field>wrapper) now automatically detect the form and create their own field context dynamically. - Global Configuration: Fully documented the
configureForm()API, which allows setting global defaults, classes, and behavior overrides (likeerrorClassandpendingClass) across the entire application. - Documentation Sync: Removed non-existent ghost components from the documentation, updated the Core API docs with missing properties (
form.changes,name.required), and clarified the input context behaviors.
Get Started
bun add @anchorlib/core@1.2.0 @anchorlib/react@1.2.0
bun add @airlib/form @airlib/react-formbun add @anchorlib/core@1.2.0 @anchorlib/solid@1.2.0
bun add @airlib/form @airlib/solid-form