docs: show how to send events between components in the same UI - #6256
Draft
totally-not-ai[bot] wants to merge 2 commits into
Draft
totally-not-ai[bot] wants to merge 2 commits into
totally-not-ai[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Preview DeploymentThis PR has been deployed for preview. URL: https://docs-preview-pr-6256.fly.dev Changed pagesAdded content is highlighted in green; removed content is marked in red on each page.
Other changed files
Built from 5370670 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review risk: two-way door — adds one section and three example classes to the component events reference page; nothing existing changes.
Summary
Adds a Communicating Between Components in the Same UI section to
articles/flow/component-internals/events.adoc. It shows how to use theUI's event bus to send events between components that don't have references to each other. The example is a search field in the main layout that tells the current view to filter its content.The docs so far only showed an event bus stored in the session. Firing events on the
UIwithComponentUtil.fireEvent()/ComponentUtil.addListener()wasn't documented anywhere.What changed
ComponentEventon theUIwithComponentUtil.fireEvent().ComponentUtil.addListener()insidewhenAttached(), so the listener is removed on detach and theUIdoesn't keep a reference to a detached view.VaadinSessionto reach all of the user's tabs, or a local signal when the components share state rather than react to events.SearchEvent,GlobalSearchFieldandOrdersViewincom.vaadin.demo.reference.componentinternals.events.ui.This replaces the "Communicate between components attached to one UI" recipe from the retired Vaadin Cookbook.
Test summary
mvn compile).🤖 Generated with Claude Code