Skip to content

Notifications: origins, interceptor and one outermost provider - #2729

Open
heswell wants to merge 3 commits into
mainfrom
feat/notification-origins
Open

heswell wants to merge 3 commits into
mainfrom
feat/notification-origins

Conversation

@heswell

@heswell heswell commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The first piece of ui-portal-latest (#2657) split out for main. It brings the branch's @vuu-ui/vuu-notifications changes on their own, because nothing in them depends on @vuu-ui/core or any other portal change.

  • Origins: NotificationOriginProvider tags notifications raised beneath it with an origin (moduleId, connectionId, and parentModuleId when nested). A notification that already has an origin keeps it. useNotificationOrigin reads the current one.
  • Interceptor: NotificationsProvider takes an optional interceptor that returns "present" or "suppress" for each notification.
  • One outermost provider: a NotificationsProvider inside another now renders only its children, so notifications from nested applications are shown once, by the outermost provider. On main providers are never nested (vuu-shell and individual showcase examples), so current behaviour is unchanged.
  • Shared contexts: the contexts are kept on the global object, so module federation remotes that load their own copy of the package still find the host's provider.
  • Callers outside a provider still have their notifications shown, by the most recently mounted provider, as on main. vuu-shell needs this: its WorkspaceProvider sits above the shell's NotificationsProvider.
  • Additions: a record flag on notifications, and exports of the descriptor types and the isToastNotification/isWorkspaceNotification guards.

The package README now explains what this version adds, with a compatibility section and a section on what the Vuu server would need to add to make full use of these attributes in a portal.

Compatibility

The changes are backward compatible: exports and notification fields are only added, children is widened, and an app with one provider behaves as before. Two cases differ, and neither occurs on main outside showcase examples:

  • Nested providers: the outermost now shows every notification. Before, the last one to mount did, usually the innermost.
  • Sibling providers: each now shows its own notifications. Before, the last one to mount showed all of them.

The branch tested this with a Vitest DOM test. Here it's a Playwright component test instead, with three showcase examples under Notifications/NotificationOrigins.

Package versions and "type": "module" are left as they are on main; they belong to the later version bump.

Test plan

  • npm run typecheck: clean
  • vitest run: 1709 pass
  • playwright test --project=components-chromium packages/vuu-notifications: 8 pass (4 existing, 4 new), including one for a caller outside the provider. It fails without the fallback.
  • Biome clean on the changed files

🤖 Generated with Claude Code

NotificationOriginProvider tags notifications raised beneath it with the
module and connection they came from, recording an enclosing module as
the parent. NotificationsProvider takes an optional interceptor that
decides whether each notification is shown.

A NotificationsProvider inside another now renders only its children, so
notifications from nested applications are shown once, by the outermost
provider. The contexts are kept on the global object, so module
federation remotes with their own copy of the package find the host's
provider.

Showcase examples and Playwright component tests cover nesting,
suppression and origins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for papaya-valkyrie-395400 canceled.

Name Link
🔨 Latest commit 880f057
🔍 Latest deploy log https://app.netlify.com/projects/papaya-valkyrie-395400/deploys/6af0f62f0fe6620b8cf2f1f3

heswell and others added 2 commits November 8, 2026 22:22
On main every provider and caller share one notification object, so a
caller outside any NotificationsProvider still has its notifications
shown, as long as a provider is mounted on the page. vuu-shell relies on
this: its WorkspaceProvider sits above the shell's NotificationsProvider.
Callers outside every provider now use the most recently mounted
outermost provider, so that keeps working.

The package README explains what this version adds and what it means for
compatibility.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Explains what the new notification attributes are for in a portal, what
the Vuu server sends today (RPC response notification actions and the
NOTIFICATIONS table), and what it would need to add: an application
column and a topic column on the notifications table, record and
dismissal fields and a Success level on notification actions. Also notes
the client changes to go with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant