DEV Community

Aleksey Suvorov
Aleksey Suvorov

Posted on

UECA-React 3.2.2: two bugs that lost state without a word

Part 5. Earlier: converting a vibe-coded MVP, the origin story, an AI agent testing the framework, UECA-React 3.2.

UECA-React 3.2.2 is a patch with no new API. It fixes two bugs that lost state without a word: no error, no warning, no failing test.

A new route kept the old screen

In UECA a component's id is its identity: DOM id, bus address and cache key. So a router can give each route its own screen through the id:

"/items/:itemId": (p) => (
    <ItemScreen
        id={"itemScreen-" + p?.itemId}
        routeParams={p}
    />
),
Enter fullscreen mode Exit fullscreen mode

Going from item 1 to item 2 changes only the id, so React keeps the element. UECA kept its model too and renamed it: no init, and item 2 opened with item 1's state. It turned up while checking the shipped agent skills against 3.2.1, whose scaffold router had exactly this shape.

Now the id is the element's key. A new id gets its own model, and the old one waits in the cache until its id comes back.

An edit went nowhere

editor: useNestedEditor({
    data: UECA.bind(() => model.entity, "nested"),
}),
Enter fullscreen mode Exit fullscreen mode

The owner and the child share one object, so the child's edits land in the entity. When the owner reloaded the entity and the nested object came back equal but as a new instance, UECA treated it as no change. The child kept the old instance, and its edits went into an object the entity no longer held. This one was reported from a real application.

Now the child takes the new instance, without running onChange, since the value didn't change.

Also

  • React 16.14 is the minimum. Earlier 16.x versions could never load the package; the peer range now says so.
  • The programming guide, the agent skills and the app scaffold are corrected against the code. If you scaffolded an app from 3.2.1, compare your dialogs and REST client with the new scaffold.

Upgrading

npm install ueca-react@3.2.2
Enter fullscreen mode Exit fullscreen mode
npx ueca-react-skills
Enter fullscreen mode Exit fullscreen mode

The second command refreshes the agent skills in your project. Details are in the changelog.

npm ยท Docs and demo

Top comments (0)