Coralite v0.29.5 Released
Coralite v0.29.5 is now available. This release refines the component context API, introducing unified AbortSignal handling across component types to simplify resource cleanup and improve signature consistency.
Unified AbortSignal in Component Context #
With this update, imperative Web Components receive a valid, automatically unmounting AbortSignal in their context object. This signal allows you to easily clean up event listeners, terminate fetch requests, and free resources when a component unmounts. To ensure a consistent API signature across all component types, declarative components now populate the signal context field with null.
export class UserProfile extends HTMLElement {
connectedCallback() {
const { signal } = this.context;
fetch('/api/user', { signal })
.then(res => res.json())
.then(data => this.render(data))
.catch(err => {
if (err.name !== 'AbortError') {
console.error('Fetch failed:', err);
}
});
}
}
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.29.5
npm install coralite-scripts@0.29.5
