Modernizing a Legacy UI

Bringing a legacy interface forward without disrupting the workflows behind it.

ReactTypeScriptVite

Patagonia, ChilePhoto: Jeremy Swagger

Agvance

As an established enterprise application continued to grow and evolve, opportunities emerged to modernize its technical foundation and improve developer efficiency. As UI Focus Group Leader, I helped guide a three-year initiative focused on adopting modern React practices, strengthening type safety, and improving maintainability. Through steady, incremental improvements, we made the codebase faster and easier to work with while preserving the stability and functionality customers depend on.

Modernization at a Glance

Tracking progress in type safety, React modernization, and development tooling.

Three years of results: React upgraded from 16 to 18; builds 60 to 80 percent faster after moving from Webpack to Vite; 478 TypeScript files added, now 64.5 percent of the codebase; 305 functional components added; over 140 UNSAFE functions trimmed; 1,092 any types removed, cutting them in half.

Legacy patterns were slowing development.

Our development was hindered by outdated dependencies and inconsistent coding practices within a well-established enterprise application. With over 2,000 instances of TypeScript's any type, we faced significant challenges in type safety, debugging, and maintenance. It was clear that modernization was essential, but we needed to achieve this without disrupting existing functionality or delaying new feature delivery.

Establishing a roadmap for incremental improvement.

As the UI Focus Group Leader, I spearheaded a long-term modernization initiative aimed at enhancing code quality and developer efficiency. We pinpointed key indicators of technical debt, such as TypeScript adoption rates, deprecated React functions, and legacy component patterns. By tracking these metrics, we established clear priorities and a transparent way to measure our progress.

Making modernization part of everyday development.

Instead of opting for a disruptive rewrite, we adopted an incremental approach that seamlessly integrated modernization into our ongoing feature development. Targeted refactoring was combined with improvements to legacy code encountered during regular work. Monthly UI Focus Group meetings allowed us to review our progress and tackle challenges, while annual presentations showcased our measurable advancements, maintaining team motivation. This approach turned modernization into a shared, ongoing responsibility.

Three years of measurable progress.

Over three years, our initiative led to significant improvements in the technical foundation of our application. Key milestones included:

  • Upgrading from React 16 to 18
  • Transitioning from Webpack to Vite, resulting in 60-80% faster builds
  • Expanding TypeScript adoption with over 350 additional files
  • Shifting to modern component patterns, with a jump to 361 functional components
  • More than doubling the use of React Hooks
  • Removing 140+ instances of deprecated lifecycle methods
Stacked bars showing TypeScript rising from 49.3 percent of the codebase in 2024 to 57.3 percent in 2025 and 64.5 percent in 2026, with JavaScript making up the rest.
Two bars comparing 56 functional components three years ago with 361 today, a gain of 305.

A healthier codebase built for the future.

The result? A healthier, more maintainable codebase and a streamlined development process. Faster builds reduce overhead, better type safety helps catch errors early, and consistent React patterns make the code easier to manage. Importantly, we’ve established a sustainable approach to modernization—continuously reducing technical debt while delivering new features and ensuring stability in our enterprise platform.

Applying modern React patterns and stronger type safety to an evolving codebase.

Formatting records

Before
UNSAFE_componentWillReceiveProps(nextProps) {
    if (nextProps.records) {
        for (const item of nextProps.records) formatText(item);
    }
}
After
getFormattedRecords = memoizeFormattedRecords(formatDetailText);
render() { ... records={this.getFormattedRecords(this.props.records)} ... }

Building select options

Before
UNSAFE_componentWillReceiveProps(nextProps) {
    this.initializePlantType(nextProps);
    this.initializePlantLife(nextProps);
    this.initializePlantStage(nextProps);
    // ...plus 2 more, and the same shape repeated in 8 panels
}

initializePlantType = (nextProps) => {
    if (nextProps[PICKLIST_PLANT_TYPE]) {          // bare truthiness
        this.setState({
            [PICKLIST_PLANT_TYPE]: prepareSelectableOptions(
                nextProps[LIST_PLANT_TYPE],
                { guid: LIST_GUID, label: VALUE, id: ID }
            ),
        });
    }
};
// render: options={this.state[LIST_PLANT_TYPE]}
After
getPlantTypeOptions = memoizeSelectableOptions((options) =>
    prepareSelectableOptions(options, { guid: LIST_GUID, label: VALUE, id: ID })
);

// render:
options={this.getPlantTypeOptions(this.props[LIST_PLANT_TYPE])}