onlyhub.work

Moving onlyhub.work to React: a real address for every screen, and no button out of place

On October 11 the whole onlyhub.work app moved from plain JavaScript to React and TypeScript. Users saw almost no difference, which was exactly the goal. Here is how we did it, and what we learned.

Moving onlyhub.work to React: a real address for every screen, and no button out of place

The first version of onlyhub.work was written in plain JavaScript. Each module (tasks, chat, docs, goals…) was its own file, a build script concatenated them in file-name order into one bundle, and the interface was built from HTML strings patched into the page with morphdom. Every screen's address was a query string: /?ws=acme&p=12&task=99.

That approach took the product a long way. But with Goals about to grow several times over, three problems became hard to ignore: a single bundle had to load everything up front, state was scattered across global variables, and there were no types to catch mistakes before users did. On October 11 we moved the whole app to React, Vite and TypeScript. This post explains how.

Rule number one: users must not notice

We decided to port the whole interface first, and only then build the new OKR features on the new foundation, instead of running two apps side by side and moving one screen at a time. For that to work, the React version had to match the old one down to the details. Three decisions made it possible:

  • Keep the CSS. The existing stylesheets are the design. They are loaded in the same order as before, and the React components emit the same class names. No Tailwind, no CSS modules, no second design system. Each new module writes its CSS in a file of its own.
  • Keep the data model. Workspace data and screen state are still two objects changed in place. After a change you call render(), and every component that uses useTick() draws again. No Redux or other state library alongside. Optimistic updates, write ordering, keyboard shortcuts and drag and drop behave exactly as before.
  • Keep the backend. Every call is still api("domain.op", {...}) to the same routes. Not one API had to change because the interface did.

A real address for every screen

The change users notice most is the address. The app now has a path router:

/w/acme                              the workspace's home
/w/acme/projects/12                  a project's tasks
/w/acme/projects/12/board            ... as a board
/w/acme/projects/12/v/88             ... a saved view
/w/acme/my | overdue | all           my tasks, overdue, everything
/w/acme/docs/123                     a doc page
/w/acme/goals                        goals
.../t/99                             any of the above, with task 99 open in the drawer
/signin/acme  /invite/...  /report/...  /share/...  /form/...

What doesn't belong to the screen stays in the query string: unsaved filters (?f=), OAuth parameters, a preview token.

The hard part wasn't building a router; it was not breaking old links. Plenty of ?ws=… links live in people's emails, notifications, chat messages and bookmarks. The answer: inside, the app still speaks the old keys (ws, page, p, task…). Two functions translate. queryOf() reads the keys from any address, old or new; pathOf() writes them back as a path. An old link opens the right screen, and the router then shows it under its new address.

A unit test keeps the two in step: more than twenty pairs of old and new addresses, checked in both directions. The rule in the codebase is simple: nobody builds "?ws=" + … by hand; every link goes through pathFor() or appLink().

One platform detail: the /login and /sso prefixes belong to the web platform we run on, so each workspace's SSO sign-in page moved to /signin/<workspace>. Each of the app's prefixes is declared as a route pointing at the page that hosts the app.

The task drawer with a description, subtasks, a checklist, comments and history
A task open in the drawer has its own address, ending in /t/<task>. Screenshots in this post come from a demo workspace.

Load only what the first screen needs

The old bundle loaded everything. The new one is split: the first screen (sign-in, the app shell, the task list and board) needs only the core, plus React, shared libraries and the reader's language pack.

Goals is the biggest module, so it is split the most carefully. What the shell has to know straight away (its sidebar entry, its ⌘K commands, its boot hooks) is registered early and kept tiny. Everything else, from the Goals page and its dialogs to each feature phase such as alignment, KPIs or 1-on-1s, sits in a chunk that loads only when you open it. Those phases plug in through one shared extension file, so they could be built in parallel without stepping on each other.

A small rule that matters: a chunk that fails to load shows "Try again" or "Reload the page", never a blank screen.

The OKR list with progress, status, score and latest check-in columns
The Goals page lives in its own chunk, loaded the first time you open it.

Testing: one script per module

For a migration whose whole point is "nothing changes", tests are the only source of confidence. The app has close to thirty Playwright scripts, one per module: tasks, views, chat, docs, calendar, automation, reports, SSO, and each phase of Goals. They run against a brand-new development server, where the backend workflows run locally, on an empty database. Each script reads addresses through the same parsing function rather than matching the query string, so the scripts worked before and after the router changed.

TypeScript runs in strict mode. No @ts-nocheck, no @ts-ignore. Raw server rows that have no shape yet use any; everything that belongs to the app is typed.

Shipping and rolling back

The app is built with Vite and deployed with one command of the platform's CLI. Every deployment is a version with a note, and going back to the previous one is also a single command. October 11 alone saw nine versions, from the first staging build to the OKR template library. A big migration feels a lot less nerve-racking when rolling back is that easy.

One platform constraint shaped the installable web app (PWA): HTML served from storage comes with a sandboxing security policy, so we didn't build an offline shell. The service worker does one job: receive push notifications.

What we learned

  • Global classes are a trap. The old stylesheet had a bare .me class that set display: flex. A table row got that class, and its cells fell apart into blocks. Since then, every new module prefixes its classes.
  • React reuses elements, even when you'd rather it didn't. In a multi-step dialog, the "Next" button turned into a "Save" button (from type="button" to type="submit") inside its own click handler. React kept the same element, the browser read the new type while handling the click, and the form submitted early. The fix: give each button its own key.
  • Keep links compatible from day one. A new router that breaks old links gets noticed immediately. Because old and new addresses go through one pair of functions, we never had to maintain two systems.
  • Split big modules early. Drawing lazy-loading boundaries during the port, before adding features, is much cheaper than splitting later.

The new foundation is why Goals could grow so quickly in October. The full list is in our October 2026 changelog.