From: v84.x β v85.0.0 | Released: 2026-04-23 | Difficulty: π’ LOW
Hoist React v85 extends the client-side tracing work started in v83/v84 with a richer and better
nested view of application startup. Hoist now creates and names well-structured parent spans for
app load, authentication, Hoist-internal init, and app-level init β and provides each service with
an InitContext so its own init work can nest underneath the correct parent in OTEL.
The single breaking change is a signature update to XH.installServicesAsync(),
HoistService.initAsync(), and HoistAppModel.initAsync() so they can receive and forward this
context. The upgrade is a small, mechanical find-replace; the real value comes from threading
ctx.span into the async work your services do during init so app-level load activity surfaces
with the same fidelity as Hoist's own.
The most significant app-level impacts are:
XH.installServicesAsync()takes(services[], ctx)β spread-args form is no longer accepted; callers must pass an array of services plus the current phase'sInitContext.HoistAppModel.initAsync()andHoistService.initAsync()receive anInitContextβ pass it through to nestedinstallServicesAsync()calls and usectx.spanas the parent for spans your service creates during init.- Propagate
ctx.spaninto fetch and async work during init (recommended) β doing so gives you per-service and per-request child spans under thexh.client.appInitroot, making application load timing clearly visible in OTEL. LoadSpecConfigreplacesLoadSpec | Partial<LoadSpec>as theloadAsync()argument β a new exported type defining the inputs callers may supply (isRefresh,isAutoRefresh,meta, and the newspan). Passspanto seed the parent trace context for spans and fetches issued within the load.- Swiper upgraded v11 β v12 β resolves a critical prototype pollution CVE. Apps consuming Swiper directly should confirm the upgrade.
- Long-deprecated APIs removed β
loadModelgetters, severalGridModel/ChartModel/ExceptionHandler/FetchServicestatic setters, and thewithFilterByField/withFilterByKey/replaceFilterByKey/withFilterByTypesfilter helpers. Replacements have all shipped previously, but agents performing the upgrade should grep for residual call sites β see Step 6.
Before starting, ensure:
- Running hoist-react v84.x
- Your package manager (yarn or npm) is available and working
- hoist-core β no new minimum is required. hoist-core >= 39.0 is recommended to pair
with this release's span sampling and app-load span changes, including the new
xhTraceConfig.sampleRulesname-based matching. See Version Compatibility for details.
Bump hoist-react to v85.
File: package.json
Before:
"@xh/hoist": "~84.0.1"After:
"@xh/hoist": "~85.0.0"Then run yarn install or npm install to update dependencies.
If your app consumes Swiper directly, note that hoist-react v85 requires Swiper ^12.1.2 (up
from ^11.2.0). Swiper 12 ships CSS sources only β update any SCSS imports in your app
accordingly:
// Before (Swiper 11)
@use 'swiper/scss';
// After (Swiper 12)
@use 'swiper/css';HoistAppModel.initAsync() now receives an InitContext argument. Update every override in
your app to accept the context and forward it to super.initAsync() and any
XH.installServicesAsync() calls.
Find affected files:
grep -rn "override async initAsync" client-app/src/Before:
import {XH} from '@xh/hoist/core';
export class AppModel extends HoistAppModel {
override async initAsync() {
await super.initAsync();
await XH.installServicesAsync(MyServiceA, MyServiceB);
}
}After:
import {InitContext, XH} from '@xh/hoist/core';
export class AppModel extends HoistAppModel {
override async initAsync(ctx: InitContext) {
await super.initAsync(ctx);
await XH.installServicesAsync([MyServiceA, MyServiceB], ctx);
}
}Repeat for every AppModel in your project β typically one per client platform
(desktop/AppModel.ts, mobile/AppModel.ts, admin/AppModel.ts) plus any example or sub-app
AppModels that override initAsync().
The spread-args form of XH.installServicesAsync() is no longer accepted - the signature is now
(serviceClasses: Some<HoistServiceClass>, ctx: InitContext). All call sites must pass the current
phase's InitContext as a second argument, and any site installing more than one service must
collect them into an array. (A single class still works unwrapped, but the array form shown below is
consistent and safe.) The ctx comes from the enclosing initAsync(ctx) parameter.
Find affected files:
grep -rn "installServicesAsync" client-app/src/Before:
await XH.installServicesAsync(MyServiceA);
await XH.installServicesAsync(MyServiceA, MyServiceB);After:
await XH.installServicesAsync([MyServiceA], ctx);
await XH.installServicesAsync([MyServiceA, MyServiceB], ctx);Forwarding ctx ensures service-init spans nest under the current phase's root span
(xh.client.appInit for app-level services).
HoistService.initAsync() now receives an InitContext argument. Update every override in your
app's services.
Find affected files:
grep -rn "override async initAsync" client-app/src/Before:
import {HoistService, XH} from '@xh/hoist/core';
export class PortfolioService extends HoistService {
override async initAsync() {
this.lookups = await XH.fetchJson({url: 'portfolio/lookups'});
}
}After:
import {HoistService, InitContext, XH} from '@xh/hoist/core';
export class PortfolioService extends HoistService {
override async initAsync(ctx: InitContext) {
this.lookups = await XH.fetchJson({url: 'portfolio/lookups'});
}
}If your service does not perform any work during init beyond what the superclass does, you can
accept the ctx parameter without using it β TypeScript's noUnusedParameters will not complain
about method parameters.
This is the minimum change required to compile. The next step is recommended to get meaningful telemetry for app load.
The primary value of the new InitContext is that it lets service init work emit child spans
under xh.client.appInit, giving OTEL a proper breakdown of where app startup time is being
spent. Without this step, service-init fetches appear as detached root spans rather than nested
children of the app load.
FetchOptions.span accepts a Span instance to serve as the parent for the request's own fetch
span. (v84 briefly widened this to also accept a SpanConfig or string name; v85 narrows it back
to Span only, so pass an actual span here.) When initializing a service, set span on the fetch
call so the request is traced as a child of the service's init span.
Before:
override async initAsync(ctx: InitContext) {
this.lookups = await XH.fetchJson({url: 'portfolio/lookups'});
this.symbols = await XH.fetchJson({url: 'portfolio/symbols'});
}After (simplest form β ctx.span as parent):
override async initAsync(ctx: InitContext) {
this.lookups = await XH.fetchJson({url: 'portfolio/lookups', span: ctx.span});
this.symbols = await XH.fetchJson({url: 'portfolio/symbols', span: ctx.span});
}After (named child span wrapping a group of calls, via HoistBase.withSpan()):
override async initAsync(ctx: InitContext) {
await this.withSpan(
{name: 'loadPortfolioRefData', parent: ctx.span, caller: this},
async span => {
this.lookups = await XH.fetchJson({url: 'portfolio/lookups', span});
this.symbols = await XH.fetchJson({url: 'portfolio/symbols', span});
}
);
}The withSpan() form is useful when init does several related calls β the wrapper span rolls them
up into one phase in the timeline. Note that spans do not propagate ambiently: pass the span
supplied to the callback down to each fetch (as above) for the individual requests to nest beneath
it. Set caller: this so the emitted span carries code.namespace.
If your AppModel.initAsync() does substantial setup beyond installing services β loading
reference data, bootstrapping caches, preparing router state β give that work a named child span
so it shows up distinctly in OTEL.
Loadable.loadAsync() now accepts a {@link LoadSpecConfig} - a plain config object with
isRefresh, isAutoRefresh, meta, and a new span field (replaces the prior
LoadSpec | Partial<LoadSpec> signature). Pass ctx.span (or a derived child span) so the
load's doLoadAsync work nests correctly. The supplied span is exposed inside doLoadAsync as
loadSpec.span; forward loadSpec to FetchService calls and any nested loadAsync() calls
as before so fetches and child loads nest under it automatically.
override async initAsync(ctx: InitContext) {
await super.initAsync(ctx);
await XH.installServicesAsync([LookupService, EventService], ctx);
// Direct: parent the load under ctx.span
await this.lookupService.loadAsync({span: ctx.span});
// Or wrap several related calls in a named child span
await this.withSpan(
{name: 'loadInitialClientData', parent: ctx.span, caller: this},
async span => {
await this.eventService.loadAsync({span});
}
);
}A few patterns worth noting from the built-in services:
-
EnvironmentServicepassesctx.spandirectly as the parent of the fetch's own span:await XH.fetchJson({url: 'xh/environment', span: ctx.span});
-
PrefServicethreadsctx.spaninto a private helper β a good pattern when init delegates to an internal method:override async initAsync(ctx: InitContext) { return this.loadPrefsAsync(ctx.span); } private async loadPrefsAsync(span: Span) { await XH.fetchJson({url: 'xh/getPrefs', span}); }
-
To emit a named child span around a fetch, wrap it with
withSpan():await this.withSpan( {name: 'loadRefData', parent: ctx.span, caller: this}, span => XH.fetchJson({url: 'portfolio/refData', span}) );
Note:
ConfigServiceandPrefServicedo this naming viarunner().newSpan(...)chains rather thanwithSpan(). ThatRunnerAPI is marked@internaland is an experimental beta feature as of v85 β apps should usewithSpan()andFetchOptions.spaninstead. (Runnerbecomes the recommended public API in v86; see the v86 upgrade notes.)
For application spans, prefer plain descriptive names (e.g. loadPortfolioRefData) β the
xh.* naming convention is reserved for framework-owned spans.
Several APIs deprecated in earlier Hoist versions (most since v82) are now removed. The
replacements have all shipped previously, so most apps will already be off them β but agents
performing the upgrade should sweep for any residual call sites. tsc --noEmit is the primary
safety net: any remaining usages will surface as missing-property or unknown-import errors.
Find affected files:
grep -rnE "\.loadModel\b|\.appLoadModel\b|applyColumnStateChanges|GridModel\.(DEFAULT_RESTORE_DEFAULTS_WARNING|DEFAULT_AUTOSIZE_MODE|defaultContextMenu)|ChartModel\.defaultContextMenu|ExceptionHandler\.(REDACT_PATHS|ALERT_TYPE|TOAST_PROPS)|FetchService\.(autoGenCorrelationIds|genCorrelationId|correlationIdHeaderKey)|withFilterByField|withFilterByKey|replaceFilterByKey|withFilterByTypes" client-app/src/Replace each match per the table below:
| Removed | Replacement |
|---|---|
model.loadModel (on HoistModel, HoistService, UrlStore, RestFormModel) |
model.loadObserver |
XH.appLoadModel |
XH.appLoadObserver |
gridModel.applyColumnStateChanges(state) |
gridModel.updateColumnState(state) |
GridModel.DEFAULT_RESTORE_DEFAULTS_WARNING = v |
GridModel.defaults.restoreDefaultsWarning = v |
GridModel.DEFAULT_AUTOSIZE_MODE = v |
GridModel.defaults.autosizeMode = v |
GridModel.defaultContextMenu (get/set) |
GridModel.defaults.contextMenu |
ChartModel.defaultContextMenu (get/set) |
ChartModel.defaults.contextMenu |
ExceptionHandler.REDACT_PATHS = v |
ExceptionHandler.defaults.redactPaths = v |
ExceptionHandler.ALERT_TYPE = v |
ExceptionHandler.defaults.alertType = v |
ExceptionHandler.TOAST_PROPS = v |
ExceptionHandler.defaults.toastProps = v |
FetchService.autoGenCorrelationIds = v |
FetchService.defaults.autoGenCorrelationIds = v |
FetchService.genCorrelationId = v |
FetchService.defaults.genCorrelationId = v |
FetchService.correlationIdHeaderKey = v |
FetchService.defaults.correlationIdHeaderKey = v |
withFilterByField(filter, newFilter, field) |
appendFilter(filter.removeFieldFilters(field), newFilter) |
withFilterByKey(filter, newFilter, key) |
appendFilter(filter.removeFunctionFilters(key), newFilter) |
replaceFilterByKey(filter, replacement, key) |
appendFilter(filter.removeFunctionFilters(key), replacement) |
withFilterByTypes(filter, newFilter, types) |
Use filter.removeFieldFilters() / filter.removeFunctionFilters() combined with appendFilter() |
After completing all steps:
-
yarn install/npm installcompletes without errors -
yarn lint/npm run lintpasses (or only pre-existing warnings remain) -
npx tsc --noEmitpasses β primary gate for the mechanical API changes - Application loads without console errors
- All
AppModel.initAsync()overrides accept and forwardctx: InitContext:grep -rn "override async initAsync" client-app/src/ - All
XH.installServicesAsync()call sites use the(services[], ctx)form:grep -rn "installServicesAsync" client-app/src/ - All custom
HoistService.initAsync()overrides acceptctx: InitContext - (Recommended) Init-time fetch calls in your services pass
ctx.span(or a derived span) viaFetchOptions.span - Grids render and function correctly (sorting, filtering, grouping)
- Forms validate and submit correctly
- If your app consumes Swiper directly: swiper styles import is
swiper/css(notswiper/scss), and carousels/pagers render correctly - No residual usages of removed deprecated APIs remain (Step 6) β the Step 6 grep returns
no matches under
client-app/src/ - (If OTEL export is enabled) App load trace in your collector shows nested
xh.client.loadβxh.client.appInitβ per-service spans, with your app's init-time fetches appearing as children
- Toolbox on GitHub β canonical example of a Hoist app; see its
client-app/src/**/AppModel.tsandclient-app/src/core/svc/*Service.tsfor the expected shape ofinitAsync(ctx)overrides. /svc/README.mdβ reference forTraceService,FetchService, and theFetchOptions.spanAPI used in Step 5./core/README.mdβ reference forHoistService,HoistAppModel, and theHoistBase.withSpan()helper used in Step 5.