Skip to content

Latest commit

 

History

History
663 lines (488 loc) · 22.3 KB

v89-upgrade-notes.md

File metadata and controls

663 lines (488 loc) · 22.3 KB

Hoist React v89 Upgrade Notes

From: v88.x → v89.0.0 | Released: 2026-10-13 | Difficulty: 🟢 LOW

Overview

Hoist React v89 is a light upgrade. Most steps apply only to apps that use the affected API, and the move to TypeScript 7 is strongly recommended.

  • TypeScript 7 (strongly recommended) - Hoist now builds and type-checks with TypeScript 7, the native port of the TypeScript compiler. Apps should move to it with this release. It takes a package.json change and two tsconfig.json options - see Steps 2-3.
  • GridFilterModelConfig.fieldSpecs (required review) - fieldSpecs is no longer an allow-list. A grid with filterable columns that fieldSpecs omits now shows a filter on those columns - see Step 5.
  • Listing icons (required if used) - Apps that list icons by iterating Object.keys(Icon) must switch to Icon.getCatalog() - see Step 6.
  • Icon faName (required if used) - Icon elements carry their FA name as props.faName, not props.iconName - see Step 7.
  • Icons added via library.add() (recommended) - Register them with Icon.register() so IconPicker offers them - see Step 8.
  • Grid rendering defaults (review) - Column virtualisation is now on, and columns without a renderer render plain text with no wrapper span. React element values in those columns need a renderer - see Step 9.
  • Badge spacing (required if used) - Badge no longer has a 5px left margin. Badges that follow text need a space or a container gap - see Step 10.
  • Column Library config (required if used) - ColLibraryConfig.autoExpandOnFilter is gone. Remove the key from any columnLibrary config - see Step 11.
  • App option presets (required if used) - Desktop themeAppOption() and sizingModeAppOption() now render a RadioCardInput. Apps passing SegmentedControl props via inputProps should add previewCards: false - see Step 12.
  • agOptions.groupDefaultExpanded (required if used) - Grid now ignores it. Set GridModel.expandLevel instead - see Step 13.
  • disableScrollOptimization flag (required if used) - GridExperimentalFlags no longer has this flag. An app that sets it fails to compile - see Step 14.

Apps can also stay on TypeScript 5.9. Hoist v89 type-checks under 5.9, 6, and 7, so the TypeScript move does not have to ship with the Hoist bump. We still recommend that you take both together.

Why Move to TypeScript 7

TypeScript 7 is a port of the TypeScript 6 compiler to Go. It applies the same type rules as TypeScript 6 and type-checks much faster. See the TypeScript 7.0 announcement for Microsoft's benchmarks.

Reasons to move now:

  • Faster type checks. The pnpm typecheck step runs meaningfully faster in CI and locally, and the gain grows with the size of the codebase.
  • TypeScript 6 is the last JavaScript release. Microsoft builds all future TypeScript releases on the native compiler. An app that stays on 5.9 builds up migration debt. An app on 7 takes later releases as routine bumps.
  • The work is small and the same for TypeScript 6. The tsconfig.json changes in Step 3 come from new TypeScript 6 defaults. You must make them for any TypeScript upgrade, so a stop at 6 first adds a second migration and no safety.
  • Same toolchain as Hoist. Hoist itself builds with TypeScript 7 from v89, and Toolbox checks against it in CI.

App builds do not change. @xh/hoist-dev-utils compiles with Rsbuild and SWC, which do not use the TypeScript compiler. TypeScript 7 changes only the tsc type check.

When to Wait

TypeScript 7.0 has no programmatic API. The new API is planned for TypeScript 7.1. A tool that imports the typescript package as a library cannot run on 7.0. ESLint is not affected, because @xh/eslint-config brings its own copy of TypeScript. Check for these cases before you start:

  • Compiler API tools in client-app/package.json. Tools such as ts-node, ts-jest, custom transformers, or an ESLint plugin that the app adds itself import typescript. If the app uses one, wait for TypeScript 7.1 and for the tool to support it.
  • Separate TypeScript projects. A test or infrastructure project with its own package.json and tsconfig.json does not need to move with the app. Leave it on its current TypeScript version. A project that runs through ts-node cannot move to TypeScript 7 until ts-node supports it.
  • Private registry mirrors. TypeScript 7 installs its compiler as a native binary, through a per-platform optional dependency such as @typescript/typescript-linux-x64. If your CI installs from a private mirror, confirm that the mirror serves these packages before you switch.

Prerequisites

Before starting, ensure:

  • Running hoist-react v88.x with @xh/hoist-dev-utils 16.x.
  • Node.js >= 22.15 (unchanged from v88).
  • hoist-core at the same version as for v88. v89 adds no new server requirements.
  • Your package manager (pnpm, yarn, or npm) is available and working.

Upgrade Steps

1. Update package.json

Bump hoist-react to v89.

File: client-app/package.json

Before:

"@xh/hoist": "^88.0.0",

After:

"@xh/hoist": "^89.0.0",

If you stay on TypeScript 5.9, skip to Step 5.

2. Update TypeScript

File: client-app/package.json

Before:

"typescript": "~5.9.3"

After:

"typescript": "~7.0.2"

Then run pnpm install / yarn install / npm install, and confirm the version:

npx tsc -v    # Version 7.0.2
  • ESLint needs no change. @xh/eslint-config bundles its own TypeScript for linting and keeps it separate from the app's copy. Version 8.1 bundles TypeScript 6, and apps on ^8.0.1 get it on their next update.
  • IntelliJ added TypeScript 7 support in version 2026.2. Update the IDE first. If it does not pick up TypeScript 7, select it in the IDE's TypeScript settings.

3. Update tsconfig.json

TypeScript 6 changed several defaults, and TypeScript 7 keeps them. Two of the new defaults break Hoist apps, so set the old values explicitly. Both options are valid on TypeScript 5.9 too.

File: client-app/tsconfig.json

Before:

{
    "compilerOptions": {
        "skipLibCheck": true,
        "useDefineForClassFields": true
    }
}

After:

{
    "compilerOptions": {
        "noUncheckedSideEffectImports": false,
        "skipLibCheck": true,
        "strict": false,
        "useDefineForClassFields": true
    }
}
  • strict now defaults to true. Hoist and Hoist apps are not written for strict mode, and an app reports thousands of errors without this setting. Skip it if your app already sets strict.
  • noUncheckedSideEffectImports now defaults to true. It rejects every import './MyPanel.scss', because TypeScript cannot find declarations for a stylesheet. As an alternative, keep the check on and declare stylesheet modules in a .d.ts file: declare module '*.scss';.

Check for these other changes, which do not affect a standard Hoist app:

  • types now defaults to [], so TypeScript no longer loads every @types package automatically. If the app uses globals from one, such as process from @types/node, list it: "types": ["node"].
  • baseUrl and moduleResolution: node are removed. Hoist apps use moduleResolution: bundler and no baseUrl.
grep -nE "baseUrl|moduleResolution|\"strict\"|\"types\"" client-app/tsconfig.json

4. Fix Inference Differences

TypeScript 7 can infer a type differently from TypeScript 5.9 in rare cases. Run the type check and fix each error at the call site.

pnpm typecheck    # or: npx tsc --noEmit

Toolbox hit one case. TypeScript 7 infers string[] for an array that mixes typed constants with a string literal, where 5.9 kept the union type:

Before:

@bindableRef accessor presets: DateRangePresetToken[] = sortBy(
    [...DEFAULT_DATE_RANGE_PRESETS, 'prevDay'],
    it => DATE_RANGE_PRESET_TOKENS.indexOf(it)
);

After:

@bindableRef accessor presets: DateRangePresetToken[] = sortBy(
    [...DEFAULT_DATE_RANGE_PRESETS, 'prevDay' as DateRangePresetToken],
    it => DATE_RANGE_PRESET_TOKENS.indexOf(it)
);

v89 also fixes a Hoist typing that failed under TypeScript 6 and later. GridProps.agOptions now accepts an HTMLElement for popupParent and the other DOM-typed AG Grid options. No app change is needed.

5. Review GridFilterModelConfig.fieldSpecs

fieldSpecs is no longer an allow-list. GridFilterModel now creates a default spec for every filterable column that fieldSpecs omits, and for columns added later through setColumns(). Before v89, a spec for any one field disabled filters on all other filterable columns.

Find affected files:

grep -rn "fieldSpecs" client-app/src/

Only fieldSpecs in a grid's filterModel config (a GridFilterModelConfig) changed. FilterChooserModel also takes fieldSpecs, and those hits need no change.

For each grid that sets fieldSpecs, check the columns that the list omits. If a column should have no filter, set filterable: false on it.

Before:

filterModel: {
    fieldSpecs: ['company', 'city']
},
columns: [
    {field: 'company', filterable: true},
    {field: 'city', filterable: true},
    {field: 'notes', filterable: true}    // v88: no filter, because fieldSpecs omits it
]

After:

filterModel: {
    fieldSpecs: ['company', 'city']
},
columns: [
    {field: 'company', filterable: true},
    {field: 'city', filterable: true},
    {field: 'notes', filterable: false}
]

You can now pass a spec for only the fields that need custom config, such as a values renderer.

6. List Icons with Icon.getCatalog()

The Icon singleton now holds lookup and registration methods, such as register() and get(), next to its factories. Code that treats every key of Icon as an icon factory now picks up these methods too.

Find affected files:

grep -rnE "(keys|values|entries|forOwn|forEach)\(Icon\)" client-app/src/

Before:

const names = without(Object.keys(Icon), 'icon', 'fileIcon', 'placeholder').sort();
names.map(name => Icon[name]());

After:

const entries = Icon.getCatalog();
entries.map(it => it.factory());

getCatalog() returns one IconCatalogEntry per glyph, sorted by display name. Each entry has the icon's name, faName, factory, and every alias in names. The catalog also includes icons the app adds with Icon.register().

7. Rename iconName to faName

IconProps.faName replaces iconName. Rendered icon elements carry the FA name as props.faName, and props.iconName is no longer set.

Find affected files:

grep -rn "iconName" client-app/src/

Code that reads the FA name from a rendered icon element must change now.

Before:

const faName = button.props.icon?.props.iconName;

After:

const faName = button.props.icon?.props.faName;

Icon.icon({iconName}) still works but logs a deprecation warning. Support ends in v91.

Before:

Icon.icon({iconName: 'github', prefix: 'fab'});

After:

Icon.icon({faName: 'github', prefix: 'fab'});

For an icon the app uses in many places, consider Icon.register() instead. It returns a typed factory and adds the icon to IconPicker.

8. Register Icons Added via library.add()

Apps that add their own FontAwesome icons by calling library.add() directly should move those calls to Icon.register(). A registered icon is offered by IconPicker, and its factory renders the icon's default weight when asked for one the app did not import.

Find affected files:

grep -rn "library.add" client-app/src/

Before:

import {library} from '@fortawesome/fontawesome-svg-core';
import {faDragon} from '@fortawesome/pro-regular-svg-icons';

library.add(faDragon);
Icon.icon({iconName: 'dragon'});

After:

import {faDragon} from '@fortawesome/pro-regular-svg-icons';

export const dragonIcon = Icon.register({name: 'dragon', defs: faDragon});
dragonIcon();

Icons added via library.add() still render. Icon.get() logs a one-time warning for each one it looks up by name.

Register icons in one app-level module imported by Bootstrap.ts, so they are registered before the app renders. A registration runs when its module loads, so one left in a lazily loaded tab is missing from IconPicker and from Icon.get() until that tab loads. Toolbox keeps its icons in client-app/src/core/Icons.ts.

Put that import below the import of @xh/hoist/core in Bootstrap.ts. Hoist's packages import each other in cycles that resolve only when core loads first. If @xh/hoist/icon is the first Hoist module to load, the app crashes at startup. Typecheck, lint and app-level cycle checks do not catch this, because the cycles are inside Hoist. See Import @xh/hoist/core First.

// client-app/src/core/Icons.ts - imported by Bootstrap.ts, below @xh/hoist/core
import {faGithub} from '@fortawesome/free-brands-svg-icons';
import {faFaceFrown, faFaceSmile} from '@fortawesome/pro-regular-svg-icons';
import {Icon} from '@xh/hoist/icon';

export const githubIcon = Icon.register({name: 'github', defs: faGithub});

export const [faceFrownIcon, faceSmileIcon] = Icon.registerAll([
    {name: 'faceFrown', defs: faFaceFrown},
    {name: 'faceSmile', defs: faFaceSmile}
]);
  • Use the returned factory. Registered names are added to Icon at runtime only, so Icon.github() does not type-check. Call githubIcon(), or Icon.get('github') by name.
  • Check the built-in set first. Registering a name that Icon already has keeps the existing icon and logs a warning. Use the built-in factory, register under another name, or pass replace: true to override it.

9. Review Grid Rendering Defaults

Two Grid rendering defaults changed for performance. Most apps need no change, but check the two cases below.

Column virtualisation is on by default. GridModel.useVirtualColumns now defaults to true, so a grid renders cells only for the columns within or near its viewport (ag-Grid's own default). Hoist's autosizing does not depend on rendered cells, so it is unaffected. If a grid needs every column's cells in the DOM - typically for test automation that reads offscreen cells - set the flag explicitly:

new GridModel({
    useVirtualColumns: false,
    ...
});

Plain cells have no wrapper span. A column with no renderer now displays its value as text written by ag-Grid, with no React component and no xh-cell-inner-wrapper span in the cell. The cell carries an xh-cell--plain class. Columns with a renderer, tree columns, and columns with an ag-Grid cellRenderer via agOptions are unchanged. A renderer-less column with an agOptions.valueFormatter now displays the formatted value, as its export already did.

Find affected styles and selectors:

grep -rn "xh-cell-inner-wrapper" client-app/src/

For a rule that should apply to such a column, target the cell. For a renderer-less column that must keep the span, add a renderer that returns the value.

Before:

.my-grid .xh-cell-inner-wrapper {
  color: var(--xh-text-color-muted);
}

After:

.my-grid .ag-cell {
  color: var(--xh-text-color-muted);
}

Element values need a renderer. ag-Grid writes a plain cell's value as text, so a React element value now shows as [object Object]. The usual source is a getValueFn that calls a Hoist formatter. fmtNumber and its variants return an element for options such as label, ledger, colorSpec and tooltip. Have the getValueFn return the raw value, and format it in a renderer. Sorting, filtering and export also read the raw value.

Find affected columns:

grep -rn "getValueFn" client-app/src/

Before:

{
    field: 'elapsed',
    getValueFn: ({record}) => {
        const {startTime, endTime} = record.data;
        if (!startTime || !endTime) return '-';
        return fmtNumber((endTime - startTime) / 1000, {precision: 2, label: 's'});
    }
}

After:

{
    field: 'elapsed',
    getValueFn: ({record}) => {
        const {startTime, endTime} = record.data;
        return startTime && endTime ? (endTime - startTime) / 1000 : null;
    },
    renderer: numberRenderer({precision: 2, label: 's', nullDisplay: '-'})
}

10. Space Badges from Preceding Text

Badge now renders inline with no outer margin, like a badge in most component libraries. The old 5px left margin assumed a badge always follows text, and it pushed standalone badges off-center in grid cells and other aligned containers.

Find affected code:

grep -rn "badge(" client-app/src/

Where a badge follows a label, separate them with a space, as with any inline element. An hbox drops that space, because it lays text out as a flex item. Replace it with a span, or keep the hbox and set a gap. Remove any margin-left: 0 or margin: 0 auto overrides that worked around the old margin.

Before:

hbox('Alerts', badge({item: count, intent: 'danger'}))

After:

span('Alerts ', badge({item: count, intent: 'danger'}))

11. Remove ColLibraryConfig.autoExpandOnFilter

The Column Library now expands every group with a match while a search is active, so the threshold no longer applies. An app that still passes the key fails to compile.

Find affected code:

grep -rn "autoExpandOnFilter" client-app/src/

Remove the key.

Before:

colChooserModel: {columnLibrary: {collapseGroups: true, autoExpandOnFilter: 3}}

After:

colChooserModel: {columnLibrary: {collapseGroups: true}}

12. Review App Option inputProps

Desktop themeAppOption() and sizingModeAppOption() now show their choices as RadioCardInput cards, each with a mini preview. Their inputProps go to that input. An app that passes SegmentedControl props there should set previewCards: false to keep the segmented control.

Find affected code:

grep -rnE "(themeAppOption|sizingModeAppOption)\(\{" client-app/src/

Calls with no inputProps need no change. They get the new cards.

Before:

themeAppOption({inputProps: {outlined: true}})

After:

themeAppOption({previewCards: false, inputProps: {outlined: true}})

13. Replace agOptions.groupDefaultExpanded with expandLevel

Grid now opens group rows with ag-Grid's isGroupOpenByDefault callback, driven by GridModel.expandLevel. ag-Grid checks that callback before groupDefaultExpanded, so a grid that sets groupDefaultExpanded in agOptions now ignores it. Such a grid logs a console warning and opens only one level, the default expandLevel for grouped grids.

Find affected code:

grep -rn "groupDefaultExpanded" client-app/src/

Move the value to expandLevel on the GridModel.

Before:

grid({agOptions: {groupDefaultExpanded: 2}})

After:

new GridModel({groupBy: ['region', 'desk'], expandLevel: 2, ...})

14. Remove GridExperimentalFlags.disableScrollOptimization

The post-load row height pass this flag disabled now runs only for grids whose rows vary in height, so the flag is gone. An app that still sets it fails to compile.

Find affected code:

grep -rn "disableScrollOptimization" client-app/src/

Remove the key from the grid's experimental config, and from any xhGridExperimental soft config.

Other Changes to Review

These need no code change in most apps.

  • @bindable, @bindableRef and @persist are typed as accessor decorators. tsc now reports one of them on a plain field. Such a field never worked: it threw in development and was not observable in production builds. Add the accessor keyword where tsc asks.
  • Store patches small changes by default. With experimental.maxPatchRatio now 0.1, records added by a small change, or newly passing a filter, are appended rather than placed at their source position. Grids with no sort may show new rows in a different order. Set a sort, or set maxPatchRatio: 0 in the store's experimental config to restore the old behavior.
  • Filters that read outside state need refreshFilter(). A patched change re-tests only the records it touches. A FunctionFilter that reads state other than the record, such as a model property, no longer re-runs on the other records when data changes. Call store.refreshFilter() when that state changes. v88 hid a missing call by re-filtering every record on each change.
  • PUT requests default to a form-encoded body. FetchService now labels every PUT without an explicit Content-Type as application/x-www-form-urlencoded, as it does for POST. v88 sent text/plain. A PUT that sends a raw body should set its own Content-Type.

Verification Checklist

After completing all steps:

  • pnpm install / yarn install / npm install completes without errors.
  • npx tsc -v reports TypeScript 7 (if you took Steps 2-3).
  • pnpm lint / yarn lint / npm run lint passes.
  • pnpm typecheck / npx tsc --noEmit passes.
  • The CI type check step passes.
  • The application builds and loads without console errors.
  • Grids with a GridFilterModel show filters only on the intended columns.
  • No code lists icons by iterating the keys of Icon.
  • No IconProps.iconName deprecation warnings appear in the browser console.
  • Wide grids scroll as expected, and any automation reading offscreen cells sets useVirtualColumns: false.
  • Styles targeting xh-cell-inner-wrapper still apply where intended.
  • Badges that follow a label are spaced from it.
  • No columnLibrary config sets autoExpandOnFilter.
  • The Options dialog shows theme and sizing choices as intended - cards, or a segmented control where previewCards: false is set.
  • No grid sets agOptions.groupDefaultExpanded, and grouped grids open to the intended level.

Reference