Migrating to 5.0

Migrating to 5.0

What changed from 4.x, and what to rename.

Updated: 2026-07-26

Renamed site exports

The old API was named after the counter demo it was extracted from. The old names still work as deprecated aliases and are removed in 6.0.

  • defineCounterSite -> defineSite
  • createCounterSite -> createSite
  • createCounterLayoutSite -> createLayoutSite
  • CounterSiteConfig -> SiteConfig
  • CounterSite -> Site
  • CounterSiteHydrationMode -> HydrationMode
  • CounterSiteRouteContext -> SiteRouteContext
  • CounterSiteErrorContext -> SiteErrorContext
  • CounterSiteLayoutProps -> SiteLayoutProps
  • CounterRenderState -> RenderState
  • createCounterRenderState -> createRenderState

Site state no longer carries count

RenderState is url, runtime, and generatedAt. The count field was residue from the counter demo. Keep a counter in component state with useState, or add your own field through createState.

The legacy toolkit moved

helper, _, createHelper, mountGlobal, WindowManager, Hotkeys, LazyLoader, LinkManager, LanguageService, HttpClient, NamespaceStorage, and ErrorCenter are no longer on the main entry. Import them from @rigbyhost/karui/legacy.

The main entry is side-effect free as a result, and dropped from 18.1 kB to 12.6 kB gzipped.

diff
-import { helper, WindowManager } from '@rigbyhost/karui'
+import { helper, WindowManager } from '@rigbyhost/karui/legacy'

Renamed internals

Rebuild server and client together โ€” a half-deployed pair will not hydrate islands. islandsKey is still configurable if you need the old value during a rollout.

  • data-bh-island -> data-karui-island
  • data-bh-island-key -> data-karui-island-key
  • __BH_ISLANDS__ -> __KARUI_ISLANDS__
  • Symbol.for('betterhelper.fragment') -> Symbol.for('karui.fragment')

Behaviour changes

These need no code changes, but they change what your app does at runtime.

  • Updates diff the DOM instead of replacing it, so focus and input values survive
  • Hydration adopts server markup instead of rebuilding it
  • key now affects hook identity, not just rendering
  • Loader data is serialized into the page and reused on first client render
  • The site server accepts POST/PUT/PATCH/DELETE instead of answering 405