Skip to content

Scope messenger hierarchy across Core, Arc.React, and Arc.React.MVVM#2232

Merged
einari merged 2 commits into
mainfrom
copilot/scope-messenger-hierarchy
May 21, 2026
Merged

Scope messenger hierarchy across Core, Arc.React, and Arc.React.MVVM#2232
einari merged 2 commits into
mainfrom
copilot/scope-messenger-hierarchy

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Summary

Implements hierarchical messenger scoping so child publishes stay local by default, while parent messages trickle recursively through descendants. Moves messenger behavior into Arc core and wires React/MVVM to resolve the nearest scoped messenger with Arc root fallback.

Added

  • Added @cratis/arc/messaging (IMessenger, Message, Messenger) with parent/child hierarchy and per-scope propagation controls: bubbleToParent and trickleDownToChildren (Scoping Messenger #2231)
  • Added Arc.React messaging primitives: MessengerScope, MessengerScopeContext, and useMessenger() for nearest-scope resolution (Scoping Messenger #2231)
  • Added specs covering default and override propagation behavior in Core/React/MVVM touchpoints (Scoping Messenger #2231)
  • Added messaging documentation pages for Core and React, and expanded MVVM messaging docs for scoped behavior (Scoping Messenger #2231)

Changed

  • Arc root context now initializes and provides a root messenger instance from <Arc /> (Scoping Messenger #2231)
  • withViewModel() now injects the nearest messenger into MVVM child containers, falling back to Arc root when no local scope exists (Scoping Messenger #2231)
  • Package exports updated so messaging is consumable via @cratis/arc/messaging and @cratis/arc.react/messaging (Scoping Messenger #2231)
import { Arc } from '@cratis/arc.react';
import { MessengerScope, useMessenger } from '@cratis/arc.react/messaging';

const Feature = () => {
  const messenger = useMessenger();
  messenger.publish(new UserSelected('42'));
  return null;
};

<Arc>
  <MessengerScope bubbleToParent={false} trickleDownToChildren={true}>
    <Feature />
  </MessengerScope>
</Arc>;

Fixed

  • Fixed propagation semantics to match issue requirements: no default upward bubbling, recursive downward forwarding by default, and explicit per-scope overrides (Scoping Messenger #2231)
  • Fixed MVVM messenger binding to register a concrete core messenger instance (compatible with parent-aware constructor) (Scoping Messenger #2231)

Removed

  • Removed MVVM-owned messenger implementation logic in favor of core messaging re-exports and shared runtime behavior (Scoping Messenger #2231)

Security

Deprecated

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node /home/REDACTED/work/Arc/Arc/node_modules/vitest/vitest.mjs run (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 21, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Implement scoped messaging hierarchy for React messenger Scope messenger hierarchy across Core, Arc.React, and Arc.React.MVVM May 21, 2026
Copilot finished work on behalf of einari May 21, 2026 11:53
Copilot AI requested a review from einari May 21, 2026 11:53
@github-actions
Copy link
Copy Markdown

NuGet packages for this PR, e.g. Cratis.Arc:
https://github.com/cratis/arc/packages/1655206?version=20.24.25

Copilot AI added a commit that referenced this pull request May 21, 2026
Co-authored-by: einari <134365+einari@users.noreply.github.com>
@einari einari merged commit 2c8e768 into main May 21, 2026
11 of 15 checks passed
einari added a commit that referenced this pull request May 21, 2026
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.

Scoping Messenger

2 participants