Problem
Client-side code (form submissions, navigation, async actions) can encounter errors that are not tied to any specific UI component — network failures, server errors, session expiry. Currently there is no way to surface these app-wide.
Proposed API
A simple event-bus on client:
client.notify(message: string, level?: "info" | "warn" | "error")
Any client-side code can call it. The root layout subscribes and renders notifications however the app wants — toast, banner, overlay.
Subscription side (in root layout component):
client.on("notify", (message, level) => {
// push to local notification state
});
Integration points
createForm calls client.notify(...) on network error instead of setErrors
boot.ts global submit/navigate error handlers call it too
- Primate users can call it from their own route handlers or components
Non-goals
- No built-in UI — Primate provides the mechanism, the app owns the rendering
- No persistence — notifications are ephemeral, in-memory only
Actionables
- Implement
client.notify / client.on event bus in client/index.ts
- Update
createForm and boot.ts to use it
- Add example notification component to docs
Problem
Client-side code (form submissions, navigation, async actions) can encounter errors that are not tied to any specific UI component — network failures, server errors, session expiry. Currently there is no way to surface these app-wide.
Proposed API
A simple event-bus on
client:Any client-side code can call it. The root layout subscribes and renders notifications however the app wants — toast, banner, overlay.
Subscription side (in root layout component):
Integration points
createFormcallsclient.notify(...)on network error instead ofsetErrorsboot.tsglobal submit/navigate error handlers call it tooNon-goals
Actionables
client.notify/client.onevent bus inclient/index.tscreateFormandboot.tsto use it