Skip to content

0.8.0 - Better API Naming, Better Types & SSR Support 🎉

Latest

Choose a tag to compare

@molszanski molszanski released this 09 Oct 08:04
· 4 commits to master since this release
584822a

🚀 TL;DR

  • no breaking changes
  • rename API so it makes more sense
  • add sync mode for react that would enable better SSR / Server Components flow
  • fix some bugs
  • improve types
  • add more tests
  • add type tests
  • improve type performance

🚀 Major Changes

API Renaming (Better semantics)

The API has been renamed from "containers" to "items" to better reflect what we're actually managing. All old methods still work and are marked as deprecated.

Core Library:

  • getContainerSet() → getItems()
  • subscribeToContainerSet() → subscribeToItems()
  • subscribeToContainer() → subscribeToItem()

React Hooks:

  • getContainerSetHooks() → getContainerHooks()
  • useContainer() → useItem()
  • useContainerSet() → useItems()

✨ New Features

1. Synchronous API for SSR

// New sync methods for better SSR support
const item = container.getSync("myService")
const items = container.getItemsSync(["serviceA", "serviceB"])

2. Enhanced React SSR Support
The useItems hook now intelligently handles SSR by returning cached values synchronously when available, preventing hydration mismatches.

🔧 Improvements

  • ✅ Migrated from Jest to Vitest (faster tests, better ESM support)
  • ✅ Better TypeScript type performance
  • ✅ More tests
  • ✅ Add tests for TS types with @arktype/attest
  • ✅ Improved ESM/CJS dual package interop
  • ✅ Added Astro playground example
  • ✅ More comprehensive type tests

📖 Quick Migration

// Core library
- await container.getContainerSet(['a', 'b'])
+ await container.getItems(['a', 'b'])

// React
- const { useContainer, useContainerSet } = getContainerSetHooks(Context)
+ const { useItem, useItems } = getContainerHooks(Context)

⚠️ Breaking Changes

None! All old APIs are deprecated but still fully functional. Migrate at your own pace.

📦 What's Changed

  • Rename API so it makes more sense
  • Add sync mode for React (better SSR / Server Components)
  • Fix bugs and improve types
  • Add more tests and type tests
  • Improve type performance

Full Changelog: v0.7.0...v0.8.0