[context] Use stopImmediatePropagation()
This PR updates the Context Protocol specification to use `stopImmediatePropagation()` instead of `stopPropagation()`. This change ensures that event handling is more precise and prevents potential issues where multiple providers might try to handle the same context request.
The change is important because:
- `stopImmediatePropagation()` prevents other event listeners on the same element from being called.
- This provides better control and clarity over which provider handles a context request.
- It prevents potential race conditions where multiple providers might try to satisfy the same request.
The specification already had consistent usage of stopping propagation throughout, so no other changes were needed.
Additionally, if it seems helpful, I can add a note to the proposal explaining the rationale behind `stopImmediatePropagation`, such as:
> Using `stopImmediatePropagation` maintains a clear contract that once a provider commits to handling a request, it alone is responsible for satisfying it, and no other providers should intervene. This ensures that no other event listeners on the same node — or any node further up the tree — can handle the same context request, avoiding race conditions where multiple providers might attempt to respond.
合并状态:已合并 合并于 2025-06-03 关闭于 2025-06-03 3 条评论