The Ephemerality Gap: Tackling Data Loss in AI-Generated UIs with an Open-Source Fix
Source: Dev.to
I’m not a professional writer, and this is a relatively new problem space, so I’ll do my best to explain it.
Generative UI (GenUI) usually means an AI agent sending a view definition (often JSON) to the frontend. The frontend renders components based on that definition and wires actions back to the agent. These views are inherently temporary—refresh the page or let the agent regenerate the layout, and the previous structure is often replaced. The upside is amazing: interfaces in complex apps can adapt instantly to your workflow. Need three extra fields? No problem. But this flexibility introduces a serious problem.
The Ephemerality Gap
I started calling this problem The Ephemerality Gap. Maybe someone has used the term before, but here’s how I define it:
The barrier to Generative UI adoption isn’t streaming tokens or model latency. Imagine a user filling out a 50‑field form that an AI just generated. Halfway through they realize they need one more field and ask the AI to add it. The AI tries to be helpful and regenerates the interface, and suddenly every single input they typed is gone—not because the user deleted it, but because the framework simply rebuilt the UI and wiped the state.
Why “just store it in a database” doesn’t work
A common suggestion is:
“Just save the user’s data in a database.”
It doesn’t work like that. This problem behaves much closer to a git merge than a simple database read/write. The UI structure itself is evolving every time the agent modifies the interface.
The technical problem
Most UI frameworks track state by matching structural keys. If the structure changes enough, the framework assumes the old nodes are gone and resets everything.
Current view definition
{
"section": {
"key": "section_1",
"children": [
{
"key": "input_2",
"type": "string",
"value": "John Doe"
}
]
}
}
Agent returns a new view
The AI decides to wrap the input in a new group or change the hierarchy:
{
"section": {
"key": "section_1",
"children": [
{
"group": {
"key": "group_99",
"children": [
{
"key": "input_3",
"type": "select",
"value": "???"
}
]
}
}
]
}
}
Because the keys or types no longer match the previous frame, the framework essentially says: “I don’t know what this is. Delete it.” The nodes reset and the data disappears. If the keys match but the types change (e.g., string → object), the application can even crash at runtime.
This is the Ephemerality Gap: the disconnect between user intent and the constantly changing structural state of the UI.
The approach
The solution is conceptually simple: user state must be durable and separate from the view structure.
- Persistent semantic identity – instead of tying user data to UI nodes, track input using a stable identifier.
- Reconciliation step – whenever the view structure changes:
- If a piece of data no longer maps to the new view, keep it rather than deleting it.
- If the AI later reintroduces that control, rehydrate the data automatically.
- If the AI tries to overwrite something the user typed, place the suggestion in a cache and let the user decide whether to accept it.
In this model, the AI never clobbers user input.
What I built
I created a runtime called Continuum. It sits between the AI agent and your frontend framework, handling the durable state layer and the reconciliation logic.
- GitHub:
- Website:
Call for community feedback
If you’re building agent‑driven interfaces, how are you handling state persistence when the UI isn’t hard‑coded? I’d genuinely like to see how other people are approaching this problem. Feel free to try the repo, break it, and fork it.