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.

javascript
Code copied!
  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:

bash
Code copied!
  npm install coralite@0.29.5
bash
Code copied!
  npm install coralite-scripts@0.29.5

Related posts

More blog posts

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!